An Interest In:
Web News this Week
- April 2, 2024
- April 1, 2024
- March 31, 2024
- March 30, 2024
- March 29, 2024
- March 28, 2024
- March 27, 2024
40 Essential Linux Commands That Every Developer Should Know
Linux is a family of open-source Unix operating systems based on the Linux Kernel. They include Ubuntu, Fedora, Debian, openSUSE, and Red Hat.
When operating Linux, you need to use a shell a program that gives you access to the operating systems services. Most Linux distribution use a graphical user interface (GUI), making them beginner friendly.
However, I recommend utilizing the command-line interface (CLI) since its quicker and offers more control.
So, in case you want to utilize Linux, learning the command utilities or commands will go a long way. For that reason, in this article I will discuss the 40 basics commands to help you guys use your own Linux effectively.
What is a Linux Command?
A Linux command is a program or utility that runs on the CLI a console that interacts with the system via texts and processes.
Here is what Linux command look like
commandName [option(s)] [parameter(s)]
The 40 Most Commonly Used Linux Commands
sudo command
Short for superuser do, sudo is one of the most widespread basic Linux commands that lets you perform tasks that require administrative or root permission.
sudo [command]
pwdcommand
Use the pwd command to find the path that you are currently working in.
pwd
cdcommand
To navigate through the Linux files and directories, use the cd command to solve this task. Depending on your current location, it requires either the full path or the directory name.
cd [path/directory]
lscommand
The ls command lists all files and directories inside your current path (include all the hidden folder or file if you are using flag -a)
ls
catcommand
Concatenate, or cat is one of the most frequently used in Linux commands. It lists and writes file to the standard output. In simple term, we print the content inside that file to our terminal.cat [fileName]
cpcommand
Cp stand for copy, what is does is copy files or directories and their contents. In this case, it will copy all the contents inside file 1 to file 2.
cp file1 file2
mvcommand
The primary use of this command is to move and rename files and directories. In this case, it will rename the file 1 to file 2.
mv [file1] [file2]
mkdircommand
Use the mkdir to create one or multiple directories at once. But note that the use who executes this command must have root or administrative permission.
mkdir [folderName]
rmdir and rm -rcommand
To permanently delete an empty folder, use the rmdir command to achive this. Now in order to delete a folder which is not empty, we can use the latter command.
rmdir [emptyFolderName]
rm -r [notEmptyFolderName]
rmcommand
This command is used to delete a file inside a specific directory.rm [fileName]
touchcommand
The touch command allows you to create an empty file.
touch [fileName]
grepcommand
Locate command can find a file in the database system. In this example, the command will search for blue in note.txt.
grep blue note.txt
dfcommand
Use the df command to report the system's disk space usage, show in percentage and kilobyte (KB).
df -h
ducommand
If you want to check how much space a file or directory takes up, use the du command.du [file/directory]
headcommand
The head command allows you to view the first ten lines of a specific file.
head [fileName]
tailcommand
Opposite to the head command, the tail views the last 10 lines inside a file.
tail [fileName]
diffcommand
Short for different, the diff command compares two contents of a file line by line. After analyzing them, it will display the parts that do not match.
diff [file1] [file2]
tarcommand
The tar command archives multiple files into a TAR file-a common Linux format similar to ZIP.
tar [achiveFile] [fileBeArchived]
chmodcommand
chmod is a common command that modifies a file or directory's read (r), write (w), execute (e) permission. In Linux, each file is associated with three user classes-owner, group and others.
chmod [permission] [fileName]
chowncommand
The chown command lets you change the ownership of a file, directory to a specified username.
chown [owner]:[group] [fileName]
jobscommand
A job is a process that the shell starts. The jobs command will display all the running processes along with their statuses.
jobs [jobID]
killcommand
Use the kill command to terminate an unresponsive program manually.
To kill a prgram, you must know its process identification number (PID). If you don't know the PID, run the first command to do it.
ps ux
kill [PID]
pingcommand
The ping command is one of the most used basic Linux commands for checking whether a network or server is readable.
ping [IP/hostName]
wgetcommand
This command line lets you download the files from the internet using HTTP, HTTPS and FTP protocols.
wget [url]
unamecommand
The uname or unix name command will print detailed information about your Linux system and hardware.
uname
topcommand
The top command in Linux Terminal will display all the running processes and a dynamic real-time view of current system. It sums up the resource utilization, from CPU to memory usage.
top
mancommand
The man command provides a user manual of any commands or utilities user can use in Terminal, including the name, description and options.
man [commandName]
echocommand
The echo command is a built-in utility that displays a line of text or string using the standard output.
echo [string]
apt-getcommand
apt-get command line tool for handling Advanced Package Tool (APT) in Linux. It lets you retrieve information and bundles from authenticated sources to manage, update, remove and install software and its dependencies. Think APT like npm in NodeJS.
apt-get [command]
Conclusion
Linux command let you perform basic and administrative tasks quickly and effectively from the Terminal.
Learning Linux basic command is essential to interact with your machine.
I hope this article has helped you learning Linux command. If you have any question, do not hesitate to drop a comment below .
Again, thank you very much for giving this blog a read and don't forget to leave me a clap and follow me for more interesting content like this .
In case you want to find more information about me, you can visit my portfolio website or my GitHub profile .
Original Link: https://dev.to/trinhcamminh/40-essential-linux-commands-that-every-developer-should-know-22hn
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To