====== Linux cribsheet ====== /* ~~REDIRECT>:crib:linux~~ */ {{tag> crib linux}} This is a [[cribsheets|personal cribsheet]] intended for my own use. If it's useful to you, great, but it doesn't cover the subject exhaustively. ===== Reboot ===== sudo shutdown -r now ===== Upgrade packages ===== sudo apt-get upgrade ===== Search ===== ** grep files like '*.haystack' for 'needle' .. ''grep -iHn needle *.haystack'' ** ''grep -i'' = case-insensitive ** ''grep -H'' = print out the name of the file before the matching line ** ''grep -n'' = print out the number of the matching line ** Find files like '*.haystack' modified in the last five days and grep them for 'needle': .. ''find . -name '*.haystack' -mtime -5 -exec grep -iHn needle {} \;'' ** the dot after ''find'' is where to start, i.e. the current working directory ** the pattern '*.haystack' has to be quote-enclosed to stop the shell expanding the wildcard ** ''-mtime -5'' means 'modification time less than five days ago. For files more than five days old, use ''-mtime +5'' ** ''-exec'' has to be semi-colon terminated to tell ''find'' where the command ends, but the semi-colon has to be escaped to stop the shell treating it as the end of ''find'' ** Find files exeeding a certain size: .. ''find . -type f -size +1M'' ** find files of size 1MB or greater ** Find files modified in the last day: .. ''find . -type f -mtime -1 | grep -v ./.git'' ** the ''grep -v'' is because you probably aren't interested in repo transactions ===== Fix VGA display alignment ===== From [[https://superuser.com/questions/1621531/missing-the-first-character-of-each-line-on-ubuntu-20-04-lts-server-terminal|SuperUser.com]]. - Open ''vim'' - Set background colour blue ('':color blue'') - Open monitor menu and select "Auto adjust"