90+ Vital Linux Commands
90+ Vital Linux Commands
4 mkdir Creates a new directory. mkdir newdir creates a directory named newdir.
Removes an empty
5 rmdir rmdir olddir removes the empty directory olddir.
directory.
in/harunseker/ 1
echo "Hello, World!" > filename.txt
creates a new text file named "filename.txt" (or
overwrites it if it already exists) and writes the phrase
"Hello, World!" into it.
Removes files or
10 rm rm file.txt deletes file.txt.
directories.
Views file content one less file.txt displays file.txt content one screen at
12 less
screen at a time. a time.
in/harunseker/ 2
14 nano Open the Nano text editor. nano file.txt opens file.txt in the Nano editor.
15 vim Open the Vim text editor. vim file.txt opens file.txt in the Vim editor.
Displays the first part of a head -n 10 file.txt shows the first 10 lines of
16 head
file. file.txt.
Displays the last part of a tail -n 10 file.txt shows the last 10 lines of
17 tail
file. file.txt.
20 sort Sorts lines of text files. sort file.txt sorts the lines in file.txt.
Searches for files in a find /home -name "*.txt" finds all .txt files in
21 find
directory hierarchy. the /home directory.
Changes file owner and chown user:group file.txt changes the owner
23 chown
group. and group of file.txt to user and group.
A programming language
awk '{print $1}' file.txt prints the first field
25 awk for pattern scanning and
of each line in file.txt.
processing.
in/harunseker/ 3
Process Management
Displays information about ps aux shows detailed information about all running
26 ps
active processes. processes.
Displays real-time system top shows real-time processes and system resource
27 top
resource usage. usage.
An interactive process
28 htop htop provides an interactive view of system processes.
viewer.
Terminates a process by
29 kill kill 1234 terminates the process with PID 1234.
PID.
System Information
Displays system
neofetch shows system information in a visually
34 neofetch information with an
appealing format.
aesthetic layout.
in/harunseker/ 4
Estimates file and directory du -sh /path/to/directory shows the total size
36 du
space usage. of a directory in human-readable format.
Lists hardware
39 lshw sudo lshw
information.
Executes a command as
sudo apt-get update runs the apt-get update
42 sudo another user, typically the
command with superuser privileges.
superuser.
Adds a new user with a sudo adduser newuser interactively adds a new
45 adduser
more interactive interface. user named newuser.
in/harunseker/ 5
sudo userdel username removes the specified
47 userdel Deletes a user account.
user account.
Modifies user account sudo usermod -aG sudo username adds the
48 usermod
properties. user to the sudo group.
Sends ICMP
ping google.com sends ping requests to
55 ping ECHO_REQUEST packets
google.com.
to network hosts.
Displays network
connections, routing netstat -tuln shows listening ports and their
56 netstat
tables, and interface status.
statistics.
in/harunseker/ 6
Traces the route packets traceroute google.com shows the route to
58 traceroute
take to a network host. google.com.
A versatile networking
utility for reading from and nc -l 1234 listens on port 1234.
60 nc
writing to network nc hostname 80 connects to 'hostname' on port 80.
connections.
Package Management
Next-generation package
manager for RPM-based sudo dnf install package installs the
64 dnf
distributions (successor to specified package.
yum).
in/harunseker/ 7
sudo dnf remove package removes the
specified package.
Other Commands
70 clear Clears the terminal screen. clear clears the terminal display.
in/harunseker/ 8
Displays the manual page
73 man man ls shows the manual for the ls command.
for a command.
Compresses files into a zip zip archive.zip file1 file2 compresses file1
76 zip
archive. and file2 into archive.zip.
resolvectl Shows the current DNS resolvectl status displays the DNS configuration
78
status settings. and status.
in/harunseker/ 9
dig example.com retrieves DNS information for
84 dig Queries DNS servers.
example.com.
Shuts down or reboots the sudo shutdown -h now shuts down the system
91 shutdown
system. immediately.
in/harunseker/ 10