OneAndOneIs2
Linux is my favourite OS, and has been since I discovered it back in the 90's. I actually don't like the direction it's taken since then - Ubuntu et al are very helpful when you just want to get up & running quickly, but most of the Linux GUIs suck massively. Unity, Gnome 3, KDE 4 are just a few of the most recent examples of the problem.
Fortunately, the command line is where I prefer to be, and this remains an area of unparalleled excellence. There's a lot of little things that the CLI can do to make life easier, many of which aren't well known. So here's a bunch of things I find worth knowing:
- mkdir -p a/b/c/d
- create subdirectories all at once
- tar:
x - extract
c - create
v - verbosely
z - zipped
j - bzipped
f - file
t - list
e.g.s
tar -cf archive.tar foo bar
- creates archive.tar containing files 'foo' and 'bar'
tar -tvf archive.tar
- lists contents of archive.tar
tar -xvzf archive.tgz
- extracts verbosely the zipped archive
- find . -perm g+w
- find . ! -perm g+w
- find files with/without specified permissions
- pgrep -u djh -l
- list all processes for 'djh'
- pstree
- list all processes in their tree
- chmod g+s dir/
- all files created in dir/ will have same group as the directory does
- mutt -a file
- email the file from the CLI
- du -hs *
- du -h --max-depth=1
- sizes of all dirs in current directory
- !!
- replace with previous command, useful for 'sudo !!'
- Ctrl-r
- interactive search back through history
- !$
- Use previous command's argument, e.g.:
mkdir newcd !$
- PATH=~bin/:$PATH
- Append directory to your path
- function name {
command $1 | command2
}
- How to define a bash function
- mtr
- clever traceroute
- sar -q
- load averages
- lsof -p `pidof X` | wc -l
- get all processes run by X
- netstat -an --unix | grep X11-unix
- Get all network connections to X11