Code360 powered by Coding Ninjas X Naukri.com. Code360 powered by Coding Ninjas X Naukri.com
Last Updated: Mar 27, 2024

Linux - Commands List

Leveraging ChatGPT - GenAI as a Microsoft Data Expert
Speaker
Prerita Agarwal
Data Specialist @
23 Jul, 2024 @ 01:30 PM

Introduction

Linux is a popular open-source operating system perfect for large server solutions. Almost all of the big tech companies have their servers running on Linux. The command line interface is preferred over GUI when working with Linux servers. Therefore it becomes crucial to have a firm grip over the most common Linux commands. 

As a developer, you will eventually work with these commands in some form or another. This blog will discuss all the significant commands based on their use cases. 💻
 

Linux: Commands List

Directories and Files

This section will go through the commands required for working with directories and files. The commands to change the directory, make new directories or remove them will be discussed.

 

cd: This command will change the current directory to a new specified directory.

chmod: Use it to change the permission of the current user. You might use root user privileges by using this command.

cat: Displays files contents

cp: This command copies files from the source to the destination directory.

file: Use it to determine the file type.

chgrp: Change Group (It changes files group)

find: Use to find specific files

grep: Searches files based on regular expressions. Regular expressions are used to define search patterns.

Is: Gives information about the type of file

head: Shows first few lines of the file

tail: Displays the last few lines of a file

mkdir: Helps create a new directory inside the current working directory

rmdir: This command removes a directory

pwd: Displays the current working directory

touch: changes the modification time of a file

mv: renames a file with a new name

more: displays data in paginated form, i.e. show data segmented in different pages

Get the tech career you deserve, faster!
Connect with our expert counsellors to understand how to hack your way to success
User rating 4.7/5
1:1 doubt support
95% placement record
Akash Pal
Senior Software Engineer
326% Hike After Job Bootcamp
Himanshu Gusain
Programmer Analyst
32 LPA After Job Bootcamp
After Job
Bootcamp

File Compression

Sometimes we have limited space and would like to compress some of our files. In such cases compressing comes handy. Let's go through some of the commands that aid in compressing and expanding operations.
 

compress: This command compresses a file.

uncompress: As the name suggests, it uncompresses a file.

gzip: A GNU bases compressing command.

gunzip: It uncompresses a zipped file.

unzip: It extracts and uncompresses a zipped file.

zcat: applies cat command to a zipped file.

zcmp: This command helps compare two compressed files.

zdiff: Compares compressed files and shows the difference.

Data Manipulation 

The data inside a file is changed and altered using the commands given below.
 

cmp: Compares data inside two files.

comm: It compares sorted data between two files.

cut: It works like a regular cut operation. That is, it snips away the selected portion.

awk: It executes pattern scanning and processing.

expand: It expands tabs to spaces.

diff: It works as a differential file comparator that compares two files and looks for the difference.

sed: Edits text in a stream.

perl: A Data manipulation language .

join: It joins two files based on some standard criteria.

sort: It sorts the content of the file.

split: As the name suggests, it splits the file into multiple smaller files.

uniq: Looks for unique lines and reports any duplicate lines.

wc: word count

vi: It opens vi text editor.

vim: Opens vim text editor.

spell: Checks content for spelling errors.

emacs: A family of emac text editors based on GNU.

Network

This section will look at the networking commands that enable Linux machines to communicate with other devices. These commands allow internet accessibility, safe browsing, data transmission and seamless server connection.
 

rlogin: It lets us log in remotely to other machines.

rcp: Remotely copy file through the network.

ftp: It enables a file transfer program.

rsh: Gives access to the remote shell.

tftp: It is the trivial version of the ftp command.

ssh: It allows logging in through secure shell protocol.

scp: It copies files on a secure shell.

sftp: secure shell version of ftp command.

telnet: It establishes a terminal connection to the host machine.

Programming

As a developer, you must install some programming tools on your system. These commands let you work with them.
 

gdb: Opens GNU debugger.

dbx: Opens sun debugger.

nm: Displays programs’ name list.

make: It compiles programs.

cb: It beautifies the C program.

cc: ANSI C compiler for sun systems.

ctrace: It opens a c program debugger.

gcc: It opens GNU ANSI C Compiler.

size: It prints programs’ size.

py: Python language interpreter.

perl: It opens Perl, a general-purpose programming language.

bc: Interactive arithmetic processor.

indent: Formats C programs for indents.

sqlplus: This command runs the Oracle SQL interpreter.

netbeans: Opens Java IDE on Linux.

Messages

To handle messaging on Linux-based systems, use the following commands.  
 

mail: This is the basic command to read and send emails.

evolution: GUI tool to handle mails on Linux.

parcel: It sends messages to other users.

pine: It is a VDU-based mail utility.

Documentation

It is difficult to remember all the commands by heart, so it becomes handy to have help available through easy commands. This section will look at some commands that can open the manual for look-up.
 

man: It displays manual pages online.

info: It displays information about commands.

whatis: This command searches the whatis database for the keyword given.

yelp: GNOME help viewer.

apropos: It looks up for the keyword to find information about the command.

Miscellaneous Commands  

Let's go through some of the commands which can help use the Linux machine efficiently. They are for general-purpose use cases.
 

chown: It changes the owner of the file.

date: It prints the date on the console.

du: Shows the disk usage.

echo: Prints arguments to standard options.

exit: It quits the logged-in system.

finger: It displays the information about logged-in users.

groupadd: It creates a new user group.

iostat: It shows the input-output statistics on the console.

kill: It sends a kill signal to a process.

netstat: It shows the network statistics.

passwd: This command changes the user’s password.

logout: It logs out the current user.

reset: It resets the terminal to its original state.

users: Prints the names of all currently logged-in users.

vmstat: It displays the virtual memory statistics.

uptime: It shows the time duration from which the system runs continuously.

Frequently Asked Questions

Why are commands more helpful in Linux Administration?

Linux servers have plenty of commands for ease of use. Also, many servers do not have monitors connected to them. Thus it's convenient to use a CLI-based approach for handling Linux systems.

What is the advantage of using commands?

Commands make use of Linux fast. Many operations not available in GUI versions can be performed using commands only. Commands give a powerful way to handle Linux systems.

What is the sudo command?

It is one of the essential commands. It gives the user superuser/root privileges. Be careful while using this command, as you can access critical sections of the server using this command.  

Conclusion

In this article, we discussed Linux Commands. These commands make it easier to handle the Linux system. We went through a detailed list of commands and saw their usage. We saw how these commands could be categorised on the type of actions they perform.

If you found this blog interesting, please visit these articles:

 

Please refer to our guided pathways on Code studio to learn more about DSACompetitive ProgrammingJavaScriptSystem Design, etc. Enrol in our courses, and use the accessible sample exams and questions as a guide. For placement preparations, look at the interview experiences and interview package.

Please do upvote our blogs if you find them helpful and informative!

Happy Learning!

Topics covered
1.
Introduction
2.
Directories and Files
3.
File Compression
4.
Data Manipulation 
5.
Network
6.
Programming
7.
Messages
8.
Documentation
9.
Miscellaneous Commands  
10.
Frequently Asked Questions
10.1.
Why are commands more helpful in Linux Administration?
10.2.
What is the advantage of using commands?
10.3.
What is the sudo command?
11.
Conclusion