Useful Commands

Decompress a tar.gz file

tar -xzf yourfile.tar.gz

Time Saving Shell Tricks

history command !!

Rerun the last command that you run, useful for when you forgot to add sudo to a command

!! or !-1 Runs the last command

!-2 Runs the second last command

Example:

$ <some command>
<some command>: Permission denied

$ sudo !!
Substitution command :s

Example:

$ sudo systemctl start sshd

$ !!:s/start/status
sudo systemctl status sshd