This content originally appeared on DEV Community and was authored by Dibyataru Chakraborty
Introduction to Linux
Linux is an extremely common operating system. An astounding 90% of all cloud computing systems run on Linux. Most servers and technology-embedded devices rely on Linux. Itβs Linux that manages and orchestrates the computing power in most of the cloud.
What is Linux?
Linux is an operating system kernel created by Linus Torvalds from scratch. As a free and open-source platform, you can modify anything in Linux and redistribute it under your own name! There are several popular Linux distributions, commonly called “distros”:
- Ubuntu Linux
- Red Hat Enterprise Linux
- Linux Mint
- Debian
- Fedora
Understanding the Linux Shell
A Linux Shell is a program that receives commands from the user, passes them to the OS for processing, and displays the output. The Shell is the interface that allows you to interact with the Linux operating system efficiently.
Exploring Linux commands can be both fun and educational! Hereβs a collection of handy commands to boost your terminal skills. 
1. grep: Search Text in Files
-
grep "search-name" filenameβ Find lines with “search-name” in a file.
-
grep -v search-name filenameβ Show all lines except those with “search-name”.
-
grep -n -v search-name filenameβ Show all lines except those with “search-name”, including line numbers.
-
grep -c search-name filenameβ Count occurrences of “search-name”.
-
grep -l search-name filenamesβ List files containing “search-name”.
-
grep -e 'search-name' -e 'search-name' filenameβ Show lines with either “search-name”.
-
grep "^startwith" filenameβ Show lines starting with “startwith”.
-
grep "endstart-withβ¦$" filenameβ Show lines ending with “endstart-with”.
-
grep -E "searchname1|searchname2" filenameβ Show lines with either “searchname1” or “searchname2”.
-
grep -l "search-name" *β List all files containing “search-name”.
2. cat: Concatenate and Display Files
-
cat > filenameβ Create or overwrite a file.
-
cat >> filenameβ Append content to a file.
-
cat -n filenameβ Show line numbers in a file.
-
cat previous-filename > new-filenameβ Copy contents from one file to another.
3. ls: List Directory Contents
-
ls *.search-extension-nameβ List all files with a specific extension.
-
ls -lβ Detailed listing of files.
-
ls -l | grep "^d"β Show directories.
-
ls -l | grep "^- "β Show regular files.
-
ls -l | grep "^-" | wc -lβ Count regular files.
-
ls -l | grep "^d" | wc -lβ Count directories.
4. File Names & Permissions
-
Max Length: 256 characters.

-
File Types:
-
-: Regular file -
d: Directory
-
-
Permissions:
-
r w xβ User -
r - -β Group -
r - -β Other
-
5. cal: Display Calendar
-
calβ Show the current month.
-
cal month-name/month-number yearβ Show a specific month.
6. date: Show Date and Time
-
dateβ Current date.
-
date +%mβ Month ID.
-
date +%Mβ Minute.
-
date +%hβ Month name.
-
date +%Hβ Hour.
-
date +%dβ Date.
-
date +%Dβ Full date.
-
date +%yβ Year (e.g., 23).
-
date +%Yβ Full year (e.g., 2023).
-
date +%Tβ Full time.
-
date +%Sβ Seconds.
-
date +%sβ Nanoseconds.
7. uname: System Information
-
unameβ Display OS name.
-
uname -sβ Kernel name.
-
uname -rβ Kernel release.
-
uname -nβ Network node hostname.
-
uname -vβ Kernel version.
-
uname -mβ Machine hardware name.
-
uname -pβ Processor type.
-
uname -iβ Hardware platform.
-
uname -oβ Operating system.
-
uname -aβ Show all info.
8. whoami: Display Current User
-
whoamiβ Show your username.
9. tty: Terminal Identifier
-
ttyβ Display terminal number.
10. pwd: Present Working Directory
-
pwdβ Show current directory.
11. whatis 'command': Command Details
-
whatis 'command'β Show details about a command.
12. cd..: Navigate to Previous Directory
-
cd..β Move up one directory level.
13. head: Show Beginning of File
-
head filenameβ Show the first 10 lines.
-
head -n number filenameβ Show the first specified number of lines.
-
head -n number1 filename | tail -n number2β Show the last number2 lines of the first number1 lines.
14. tail: Show End of File
-
tail filenameβ Show the last 10 lines.
-
tail -n number filenameβ Show the last specified number of lines.
15. script: Record Terminal Session
-
scriptβ Start recording your terminal session.
16. exit: Exit Terminal
-
exitβ Exit the terminal session.
17. clear: Clear Terminal Screen
-
clearβ Clear the terminal screen.
18. bc: Calculator Environment
-
bcβ Start the calculator environment.
19. cp: Copy Files
-
cp oldfile newfileβ Copyoldfiletonewfile.
20. rm: Remove Files
-
rm filenameβ Remove a file.
21. rmdir: Remove Directory
-
rmdir directory-nameβ Remove a directory.
22. rm -d: Remove Directory
-
rm -d directory-nameβ Remove a directory.
23. mv: Move or Rename Files
-
mv oldfilename newnameβ Renameoldfilenametonewname.
24. comp: Compare Files
-
comp file1 file2β Show differences betweenfile1andfile2.
25. conm: Show Common Data
-
conm file1 file2β Show common data betweenfile1andfile2.
26. chmod: Change File Permissions
-
chmod a+x filenameβ Add execute permission for all.
-
chmod a-x filenameβ Remove execute permission for all.
-
chmod =r filenameβ Give read permission to all.
-
chmod =rw filenameβ Give read/write permission to user.
-
chmod =x filenameβ Give execute permission to all.
-
chmod go+w filenameβ Give write permission to group and others.
-
chmod -R a+x directory-nameβ Add execute permission recursively.
-
chmod a-rwx filenameβ Remove all permissions.
-
chmod 421 filenameβ Set specific permissions.
27. Octal Permissions
-
Binary β Octal β Permissions
-
000 β 0 β ---β No permission.
-
001 β 1 β --xβ Executable only.
-
010 β 2 β -w-β Writable only.
-
011 β 3 β -wxβ Writable and executable.
-
100 β 4 β r--β Readable only.
-
101 β 5 β r-xβ Readable and executable.

-
110 β 6 β rw-β Readable and writable.

-
This content originally appeared on DEV Community and was authored by Dibyataru Chakraborty