There are some tips for Ubuntu that are not as well known as they should be.
One tip is searching the bash history.
Press Control-R and a prompt will appear.
(reverse-i-search)`sudo': sudo apt-get install libxml2-utils |
Type a search like “sudo” for example, and the first search result will cope up, this is the last command entered that contains the text “sudo”. Keep pressing Control-R and cycle through each match until you find the command you are looking for.
List only sub-directories in a directory with this easy command.
4.4 Thu Apr 30 jason@Yog-Sothoth 0: $ ls -d */ functions/ media/ mission/ scripts/ |
Delete all files in a directory but one file.
jason@Yog-Sothoth:~/Documents/Ubuntu/etc$ rm -rf !("legal") |
Delete all files in a folder except for 2 specific files.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | jason@Yog-Sothoth:~/Documents/tixati$ rm -v !("colors2.dat"|"rss2.dat") removed 'autothrottle2.dat' removed 'autothrottle2.dat.lastloadok.dat' removed 'bwpresets2.dat' removed 'bwpresets2.dat.lastloadok.dat' removed 'channels2.dat' removed 'channels2.dat.lastloadok.dat' removed 'colors2.dat.lastloadok.dat' removed 'core2.dat' removed 'core2.dat.lastloadok.dat' removed 'dht2.dat' removed 'dht2.dat.lastloadok.dat' rm: cannot remove 'incomplete-pieces': Is a directory removed 'rss2.dat.lastloadok.dat' removed 'scheduler2.dat' removed 'scheduler2.dat.lastloadok.dat' removed 'settings2.dat' removed 'settings2.dat.lastloadok.dat' removed 'uisettings2.dat' removed 'uisettings2.dat.lastloadok.dat' removed 'upnp_diagnostic_log.txt' |