Unix Cheatsheet Cheat Sheet by fires
linux command unix service
Where am I in the system
List of given path. Common params -l -h -a
Used in paths as a reference to your home directory (eg. ~/Documents )
Used in paths as a reference to your current directory (eg. ./bin ).
.. (dot dot)
Used in paths as a reference to your current directories parent directory (eg. ../bin ).
Start typing and press TAB. The system will auto complete the path. Press TAB twice and it will show you your alternatives.
mkdir <dir name>
rmdir <dir name>
remove empty directory
remove file also non-empty folder with -f param (-r recursively)
touch <file name>
create empty file
cp <source> <destination>
copy source to destination
mv <source> <destination>
move source to destination also used for rename
show the first n lines (-n)
show the last n lines (-n)
sort lines in a given way
How many words, characters and lines.
search for given patters
Wildcards - May be used anywhere in any path
Zero or more characters (eg. b*).
Single character (eg. file.???).
Range (eg. b[aio]t).
du -sh [dir/file]
Disk usage (-s summary -h humman readable)
Display how much disk space is used and also free
find /home -mtime -1
Find all files in the given directory (and subdirectories) which have been modified in the last 24 hours.
shutdown -h now
Shutdown the system. (Replace -h with -r for reboot.)
Show the current date and time
who you are logged in as
display information about user
show the manual for command
show possible location of app
show which app will be run by default
Owner(user) Group Other
chmod <permissions> <path>
hange permissions. Permissions can be either shorthand (eg. 754) or longhand (eg. g+x)
Piping and Redirection
Redirect STDOUT to a file.
Redirect STDOUT to a end of file.
Redirect the STDERR to a file.
Pass the contents of a file to a program as STDIN.
Feed the STDOUT of the program on the left as STDIN to the program on the right.
Config files virtual hosts
Restart service gracefull
Restart service hard
sudo service apache2 restart
service mysql restart
service mysqld restart
systemctl status mysql.service
CTRL + C
Cancel the currently running process
kill <process id>
Cancel the given process. Include the option -9 to kill a stubborn process
Obtain a listing of processes and their id's. Including the option aux will show all processes.
See a list of current processes in the background.
CTRL + Z Pause the currently running process and put it in the background.
fg <job number>
Move the given process from the background to the foreground.
Download the Unix Cheatsheet Cheat Sheet
Like this cheat sheet? Check out our sponsors!
Readable.io is a collection of tools to make your writing better. More readable content means higher conversion rates and better reader engagement. Measure website and document readability, measure keyword density and more!
Click Here To Get Started!