Cheat Sheet - Linux

Cheat Sheet - Linux

#Navigation

pwd → Prints the current working directory. 
cd → To change the current working directory. 
cd .. → To move one directory back. 
ls → Lists the contents of a directory. 
ls -la → To show hidden files.

#System Info.

whoami → Displays the current user. 
uname → Displays system info. 
hostname → Display or set system’s hostname.

#File system info.

df → To check the file system disk space usage. 
free → Displays system memory usage. 
du → Displays the file/dir space usage.

#File/Dir operations

echo → To print anything. 
touch → Creates a new empty file. 
mkdir → Creates a directory. 
vi/vim → Edits the content of file. 
cat → To read the content of file. 
read → Waits for user input.
sudo → To give administrator permissions. 
mount → To mount a file system.
chown → To change the ownership of a file/directory.
chmod → To change permissions of file/directory. 
chgrp → To change the group ownership of a file/directory. 
rm → To delete a file. 
rm -rf → To Remove directories and content recursively. 
rmdir → To delete a directory. 
mv oldname newname → To rename file/directory. 
cp source destination → To copy file/dir from source to destination location.
mv source destination → To move file/dir from source to destination location. 
grep → To search for something specific in a file. 
awk → To extract specific fields from a file. 
find → To fi nd file/directory. 
sed → To search for patterns in a text. 
head → To print the first n no. of lines of a file. 
tail → To print the last n no. of lines of a file. 
tar → Used to create Archive and extract the Archive files.

#Local to Remote connection

scp → To securely copy files between two machines. 
ssh → To securely log into a remote machine.

#Process Management

ps → Displays info about processes.
top → Displays top running processes. 
kill → To terminate a process. 
pkill → To kill the process by its name.

#User Management

useradd → To add a new user. 
userdel → To remove an existing user. 
groupadd → To add a new group.

#ACL commands

getfacl → For getting detailed permission of a file. 
setfacl → For setting up ACL.

#Networking

ping → Checks network connectivity. 
traceroute → Trace a route to a host. 
ifconfig → Config network interfaces. 
netstat → Display network connections. 
iptables → Configure firewall rules.

*👆The information presented above is based on my interpretation. Suggestions are always welcome.*😊

~Smriti Sharma✌