Useful collection of CLI one-liners

If you use the Linux command line interface, here’s a link to a large collection of handy shortcuts:

www.commandlinefu.com/commands/browse/sort-by-votes

Some examples from the site:

sudo !!
Useful when you forget to use sudo for a command. “!!” grabs the last run command.

'ALT+.' or '<ESC> .'
Place the argument of the most recent command on the shell.
When typing out long arguments, such as: cp file.txt /var/www/wp-content/uploads/2009/03/
You can put that argument on your command line by holding down the ALT key and pressing the period ‘.’ or by pressing Escape then the period ‘.’. For example: cd 'ALT+.'

mount | column -t
currently mounted filesystems in a nice layout.

man ascii
When you need quick access to the ASCII table

ctrl-l
Clear the terminal screen.

(cd /tmp && ls)
Jump to a directory, execute a command and jump back to current dir

disown -a && exit
Close shell keeping all subprocesses running

5 Likes
mount | grep "^/dev" | column -t

currently mounted partitions in a nice layout

Nice, I like this to be able to serve up a directory to https://localhost:8000

$ python -m SimpleHTTPServer

1 Like

Starting with v5.4.0, PHP has a built-in mini web server too.

http://php.net/manual/en/features.commandline.webserver.php

https://wiki.php.net/rfc/builtinwebserver

2 Likes