Linux Command Cheatsheet for Beginners

Linux Command Cheatsheet For Beginners

In this tutorial you’ll learn basic and the most used Linux commands. This Linux Command Cheatsheet For Beginners will help you gain the necessary understanding of daily task execution through the terminal.

Linux (opens in a new tab) is the preferred Operating system among professional developers because it makes very efficient use of the system’s resources.

Linux Command Cheatsheet

The commands discussed below may not help you become a pro in a day, but practicing all and learning new things along with implementing everything in a positive manner will make you an efficient Linux user.

1. File Management

lsLists all the files in the current directory
ls -lShows files along with permissions
ls -alShows a list of all the files including hidden files
ls -ltSorting the listing by time modification
pwdShows the Present Working Directory
cdPrints Current Directory
cd ..Change the directory to the parent directory
cd –Change to the previous directory
cd dir_nameChange the directory to "dir_name"
mkdir dir_nameMake a directory with "dir_name"
cat > filenameCreates a new file with 'filename'
cat filenameDisplays file content
cat file1 file2 > file3Concatenate or join two files into one
touch filenameCreate a new file with 'filename'
rm filenameRemoves the file
rm -r dirRemoves a directory named 'dir'
cp file1 file2Copy file1 and call it file2
cp -r dir1 dir2Copy contents of directory 'dir1' to 'dir2'
mv file1 file2Move file1 to file2
echo 'Hi' > data.txtEnter content into a file
echo 'There!' >> data.txtAppend text to an existing file in Linux
nano filenameOpens file in an editor
vim filenameEnables an efficient text editor
tar -cvf archived.tar /indgeekCompress files and folders in Linux
tar -xvf archived.tarExtracts the tar archive file
sudoAllows regular users to run with Superuser privileges
apt-getCommand used to install and update packages
psDisplays the current working processes
manOpens the help manual of a command
pidofGives the Process ID (PID) of a process
kill PIDKill the process with the given PID
top -u igeekDisplay specific User process details
niceStarts a process with a given priority
reniceChanges the priority of an already running process
dfGives free hard disk space on your system
freeGives free RAM on your system
bgTo send a process to the background
fgTo run a stopped process in the foreground

Read More: Basic SQL Cheat Sheet

3. Permissions

Linux permissions grating is a tricky task that you may memorize with simple syntaxes.

Remember providing ‘Read Permission‘ to any user would only allow them to read the file, that specific user won’t be able to write/ modify or execute that file or application.


Every file and directory on a Linux system can be assigned 3 types of Owners,

  • Owner: The Owner is the creator of a specific file or Directory
  • Group: A Group can contain multiple users
  • Others: A person who has neither created the file nor belongs to a user group who owns the file.
+Adds permission
Removes permission
=Assigns the permission
rRead Permission
wWrite Permission
xExecuting permission
0No permissions
1-x (execute only)
2-w- (write only)
3-wx (write and execute)
4r- (read only)
5r-x (read and execute)
6rw- (read and write)
7rwx (read, write, and execute)

Permissions Examples

  • chmod +rwx filename: Adds all permissions to a user.
  • chmod -rwx filename: Removes all permissions from a user.
  • chmod +w filename: Allows users to modify the file.
  • chmod +r-x filename: Allows a user to read and execute.
  • chmod 777: Completely permits Owner, Groups, Others.

Changing Ownership

  • chown user: Changes the ownership of a file/directory.

4. System

usersShows the username of users currently logged in
wDisplays who is online
whoamiDisplays the current logged-in user to this system
finger userShows information about the user
sudo adduser usernameAdds a user with a username
sudo userdel -r 'username'Removes 'username' user
sudo passwd -l 'username'Changes the password of a user
sudo usermod -a -G Gname UnameAdd user to a Group
uname -aShows Kernel information
uname -mShows Architecture information
cat /proc/cpuinfoDisplays CPU information
cat /proc/meminfoDisplays memory information
free -tShows total memory used & available


  • Use sudo before commands that require administrative privileges.
  • For sudo userdel -r 'username', the -r option removes the user's home directory and mail spool.
  • sudo passwd -l 'username' is used to lock the password of the specified user.
  • sudo usermod -a -G Gname Uname adds the user to a specified group.

Also Read: Advantages of using Linux

5. Searching

grep pattern filenameSearch for "pattern" in the file
grep -i "indgeek" geeks.txtEnables searching for a string case-insensitively
grep -c "igeek" geeks.txtDisplays the count or number of matches
grep -r pattern dirSearches recursively for patterns in the directory
locate filenameFinds all instances of a file
grep -v "igeek" geeks.txtDisplays the unmatched lines with the searched pattern
find . -name geeks.txtFinds all files whose name is geeks.txt in the PWD
find / -type d -name IndGeekFinds directories whose name is IndGeek in the / directory


  • Use grep to search for patterns within files.
  • -i in grep -i "indgeek" geeks.txt enables case-insensitive searching.
  • -c in grep -c "igeek" geeks.txt displays the count of matches.
  • -r in grep -r pattern dir searches recursively in the specified directory.
  • locate filename quickly finds all instances of a file.
  • grep -v "igeek" geeks.txt displays lines without the searched pattern.
  • find . -name geeks.txt finds files with a specific name in the present working directory.
  • find / -type d -name IndGeek finds directories with a specific name in the root directory.

6. Networking

ssh igeek@ into the remote host at a specific address as user 'igeek'
ftp to a remote FTP host
ping indgeek.comPing and analyze network and host connections
ifconfig -aDisplay network information
netstatShows active or listening ports
whois domainGet whois information for a domain
dig domainGrabs DNS information of a domain
dig -x hostReverse lookup host
wget filenameDownloads a file
wget urlDownloads a file from a specific URL
put fileUploads 'file' from local to the remote computer
get fileDownloads 'file' from remote to local computer
quitLogout as a user


  • Use ssh to log into a remote host.
  • ftp connects to a remote FTP host.
  • ping is used to analyze network and host connections.
  • ifconfig -a displays detailed network information.
  • netstat shows active or listening ports.
  • whois domain retrieves whois information for a domain.
  • dig domain grabs DNS information of a domain.
  • dig -x host performs a reverse lookup on a host.
  • wget is used to download files from the web.
  • put uploads a file from the local machine to the remote computer.
  • get downloads a file from the remote machine to the local computer.
  • quit is used to log out as a user.

IndGeek provides solutions in the software field, and is a hub for ultimate Tech Knowledge.