This is a (personal) list of some useful UNIX commands. Don't hesitate to submit a pull request if you have suggestions! ;-)
curl ifconfig.co
: get the IP address of the machinepython -m SimpleHTTPServer 4242
: start a minimalist webserve that serves the current directory on port 4242netstat -tulpn | grep ':4444'
: see what process is listening on port 4444lsof -i:4444 -t | xargs -r kill
: kill any process listening on port 4444iotop
: see what processes are waiting for I/Opkill nginx
: kill all the processes namednginx
getconf _NPROCESSORS_ONLN
: get the number of CPUsgrep -ir '// todo'
: find all files in the current directory containing// todo
, ignoring casefind . -type f | wc -l
: find recursively the number of files in the current directory (excluding directories)pushd /some/path
andpopd
: change directories, push the current directory to a directory stack, and go back. Example:
~ $ pushd /etc
/etc $ pushd /var/www
/var/www $ popd
/etc $ popd
/ $