1. Making a Temporary Filesystem (Ramdisk)There are several reasons to make a temporary RAM-based filesystem such as fast read/write times or to guarantee that the files will not persist after reboot. Making such a “fake” filesystem is easy, and just requires one command.
Where /mytemppartion is the location you wish to mount (it must already exist) and 1024m is the desired size of the ramdisk.
mount -t tmpfs tmpfs /mytemppartition -o size=1024m
2. Quickly Scheduling CommandsLinux pros almost certainly know the at command, it lets you set a specific time for a job to be run. You simply say what to do and when to do it, and at takes care of the rest. Its usage can be confusing for some, so here’s one common way of scheduling a task with at.
If you want to verify that it worked, you can easily list the sceduled jobs with
at 12:30 #Enter key somecommandtorun anothercommand #ctrl-D
3. Re-run Previous CommandsPerhaps you ran a long complicated command, but forgot to preface it with sudo, or maybe you didn’t add some necessary options to the end. Instead of retyping the whole thing or going back through your shell history, you can use “double bangs” to represent your last command.
If you’re the type who tracks your command history numbers, you can use the same approach to recall any previous command by referencing its number:
mkdir /etc/myDir #Permission denied sudo !! #Success!
4. Find the PID of a ProcessIf you need to kill a particular process but don’t have its PID, there’s a simple shortcut to find it – the pgrep command. It doesn’t do anything that can’t be done with a combination of ps and grep, but every little bit helps.
5. Show Listening Ports and their ProcessesIf you need to see what’s listening for connections on your system, and the processes handling those connections, the old trusty netstat tool is up to the job. Try
to see just such a list.
6. SSH Without PasswordsMany people, such as this author, use SSH on a nearly constant basis. It’s a great tool, there’s no denying that, but having to constantly retype your passwords can get annoying. Instead, you can simply copy your (public) SSH information to the remote machine, allowing it to authenticate you without requiring your password, and all you need is a single command.