Hello Everyone π !
I switched to Linux only a year ago, and my productivity has skyrocketed. You should too if you haven't already.
I used Windows for more than 2 years when I was exploring tech, and it became necessary for me to switch to Linux to set up cloud-native projects for open-source contributions, and the results have been amazing.
Why should you switch to linux ?
- Literally just one command to install and delete applications. (No setup menu and no menu which asks for survey after you uninstall a project :p)
- Extremely powerful terminal. (you can even erase entire system with it) - One command to upgrade stuff (No continuous reboots)
- Extremely Fast because less bloat - Widely recognized commands which you can find getting utilized in various Open-source projects, youtube tutorials
Linux has been the primary choice for DevOps/SysAdmins because it is the most widely adopted OS, being mainstream in server environments, scripting, automation, and reliable integration with cloud-native environments and containerization such as Kubernetes and Docker.
Linux is the fundamental skill to master before diving deep into more complex technologies like Kubernetes. It is also very helpful for software engineering tasks. Linux provides much better ease and clarity while performing tests and running load-intensive computations. You can easily kill processes, restart applications and services, and change file content simply via the terminal.
I personally use Ubuntu as my primary choice of Linux distro, and you can choose based on your preference. There are many other popular choices such as β
CentOS
Kali Linux
Linux Mint
Arch linux
Few notes β
- Learn Vim and nano editors. it enables ability to change file content through command line and saves a lot of time - Understand wildcards in linux. it is basically asterik (*) which can be used to represent any value with same itβs same prefix or suffix Usage examples :
ls *
β List all files and directories in the current directory.ls *.txt
β List all files ending with.txt
.rm hello*
β Remove all files starting withhello
. let it be hello.txt, hello.zip or hello.cpp
Navigating Directories Through Command Line β
There are times when you need to enter a subdirectory or move out of it. Here's how to do it:
A single dot (
.
) represents the current directory in Linux.cd .
β Stays in the same directory.
Double dots (
..
) represent one level up from the current directory.cd ..
β Moves one directory up.cd ../..
β Moves two directories up.
../
is used to move out of a directory while staying in the command.ls ../
β Lists files in the parent directory.mv file.txt ../
β Movesfile.txt
to the parent directory.
Tilde (
~
) represents the home directory of the current user.cd ~
β Moves directly to the home directory.cd ~/Documents
β Moves to theDocuments
folder inside the home directory.
Hyphen (
-
) represents the previous directory you were in.cd -
β Switches back to the last directory you visited.
Note - You can directly change paths if you provide the absolute path. For example β
you are in /usr/bin/ path and you want to jump to $USER directory which is present inside /home directory, you can simply do a cd /home/$USER to reach there. you can also run any script directly like this and much more.
List of Popular and Most used Linux Commands :
Important note : To understand anything in depth, please always refer to Official documentation/Man pages. They are always the best source of information and each command have a lot of options/flags which you can find in the official documentation.
1. File & Directory Management
These commands help navigate, create, move, and delete files or directories.
ls β List files and directories
Usage:ls [options] [directory]
ls -l
β Long format (detailed list)ls -a
β Show hidden filesls -lh
β Human-readable file sizes
pwd β Print current working directory
Usage:pwd
- Shows the full absolute path of the current directory
cd β Change directory
Usage:cd [directory]
cd /home/user/Documents
β Move to Documentscd ..
β Move one level up
mkdir β Create a new directory
Usage:mkdir [directory_name]
mkdir new_folder
β Createsnew_folder
rmdir β Remove an empty directory
Usage:rmdir [directory_name]
rmdir old_folder
β Deletesold_folder
if empty
rm β Remove files and directories
Usage:rm [options] [file/directory]
rm file.txt
β Deletesfile.txt
rm -r folder/
β Deletesfolder
and its contentsrm -rf folder/
β Force delete without confirmation
cp β Copy files and directories
Usage:cp [options] [source] [destination]
cp file.txt /home/user/
β Copyfile.txt
to/home/user/
cp -r folder1 folder2
β Copyfolder1
and all its contents tofolder2
mv β Move or rename files and directories
Usage:mv [source] [destination]
mv file.txt /home/user/
β Movefile.txt
to/home/user/
mv oldname.txt newname.txt
β Rename a file
find β Search for files and directories. You can find many flags in documentation
Usage:find [directory] -name [filename]
find /home -name file.txt
β Search forfile.txt
in/home
find /home -type f -name file.txt
β File specified Search forfile.txt
in/home
file - The
file
command in Linux is used to determine the type of a file.Usage:
file [options] [filename]
file document.txt
β This tells us thatdocument.txt
is a plain text filefile *
β Identify the type of all files in a directory
2. File Operations
Used for reading, editing, comparing, and managing files.
touch β Create an empty file
Usage:touch [filename]
touch newfile.txt
β Createsnewfile.txt
cat β Display the content of a file
Usage:cat [filename]
cat file.txt
β Show content offile.txt
more β View file content page by page
Usage:more [filename]
- Use
SPACE
to scroll down
- Use
less β Scroll through a file (better than
more
)
Usage:less [filename]
- Use arrow keys to navigate
head β Show first few lines of a file
Usage:head -n [number] [filename]
head -5 file.txt
β Show first 5 lines
tail β Show last few lines of a file
Usage:tail -n [number] [filename]
tail -10 file.txt
β Show last 10 lines
nano β Edit a file in a simple text editor
Usage:nano [filename]
- Use
CTRL + X
to exit
- Use
vi / vim β Advanced text editor
Usage:vi [filename]
Press
i
to enter insert modePress
ESC
, type:wq
to save and exit
grep β Search for a pattern inside a file
Usage:grep [pattern] [filename]
grep "error" logfile.txt
β Find "error" inlogfile.txt
diff β Compare two files
Usage:diff [file1] [file2]
diff file1.txt file2.txt
β Show differences
3. File Permissions & Ownership
Manage read, write, and execute permissions.
chmod β Change file permissions
Usage:chmod [permissions] [file]
chmod 755
script.sh
β Set executable permissions
chown β Change file ownership
Usage:chown [user]:[group] [file]
chown user1 file.txt
β Change owner touser1
chgrp β Change group ownership
Usage:chgrp [group] [file]
chgrp staff file.txt
β Assign file tostaff
group
4. Process Management
Monitor and control running processes.
ps β Show active processes
Usage:ps aux
- Lists all running processes
top β Real-time process monitoring
Usage:top
- Displays real-time system stats
htop β Interactive process viewer
Usage:htop
(Requires installation)- More advanced than
top
- More advanced than
kill β Terminate a process
Usage:kill [PID]
kill 1234
β Kill process with PID1234
pkill β Kill process by name
Usage:pkill [process_name]
pkill firefox
β Kill all Firefox processes
5. Networking Commands
Manage network settings and connections.
ip a β Show IP addresses
ping β Test network connectivity
Usage:ping [website]
ping
google.com
netstat -tulnp β Show open ports
curl β Transfer data from a URL
Usage:curl [flags] [URL]
curl -O
example.com/file.txt
wget β Download files
Usage:wget [URL]
6. System Monitoring & Information
View system details and performance.
free -h β Show ram usage
whoami β Display current user
uname -a β Show system information
df -h β Show disk usage
du [options] [directory] β Show directory size
7. Package Management
Install, update, and remove software.
apt install [package] β Install a package (Debian/Ubuntu)
yum install [package] β Install a package (RHEL/CentOS)
zypper install [package] - Install a package (OpenSUSE)
That's it from my side. Please leave comments if you have any doubts, and I will answer them. Subscribe to my newsletter !
Connect with me on LinkedIn | GitHub.
Thanks for reading :)