0% found this document useful (0 votes)
10 views

90+ Vital Linux Commands

Uploaded by

ankushmahato789
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

90+ Vital Linux Commands

Uploaded by

ankushmahato789
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

No Command Description Example

File and Directory Management

Prints the current working


1 pwd pwd displays the full path of the current directory.
directory.

ls -l lists files in long format, showing permissions,


owner, size, and modification date.

ls -a lists files including hidden files (those starting


2 ls Lists directory contents.
with a dot)

ls -la list directory contents in a long format,


including hidden files.

Changes the current


3 cd cd /home/user changes the directory to /home/user.
directory.

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.

Creates an empty file or


touch newfile.txt creates an empty file named
6 touch updates the timestamp of
newfile.txt.
an existing file.

Displays a line of text or a echo "Hello, World!"


7 echo
variable value. prints Hello, World! to the terminal.

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.

echo "Hello, World!" >> filename.txt


appends the phrase "Hello, World!" to the end of the
existing file named "filename.txt" (or creates the file if it
doesn't exist).

cp file1.txt file2.txt copies file1.txt to


file2.txt.
8 cp Copies files or directories. cp file1.txt ./Desktop copies the file named
"file1.txt" from the current directory to the Desktop
folder.

mv oldname.txt newname.txt renames


oldname.txt to newname.txt in the current directory.
used for moving and
9 mv renaming files and mv file1.txt ./Desktop moves the file named
directories.
"file1.txt" from the current directory to the Desktop
folder.

Removes files or
10 rm rm file.txt deletes file.txt.
directories.

File Viewing and Editing

Concatenates and displays


11 cat cat file.txt displays the content of file.txt.
file content.

Views file content one less file.txt displays file.txt content one screen at
12 less
screen at a time. a time.

displays the content of


13 more the file one screen at a more file.txt
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.

Compare two files byte by


18 cmp cmp file1 file2 compares file1 and file2.
byte.

diff file1 file2 shows the differences between


19 diff Compares files line by line.
file1 and file2.

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.

chmod 755 script.sh sets the permissions of


22 chmod Changes file permissions.
script.sh to rwxr-xr-x.

Changes file owner and chown user:group file.txt changes the owner
23 chown
group. and group of file.txt to user and group.

Searches for patterns in grep "pattern" file.txt searches for "pattern"


24 grep
files. in file.txt.

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.

Terminates processes by killall firefox terminates all processes named


30 killall
name. firefox.

Displays running pstree shows the process hierarchy, with child


31 pstree
processes as a tree processes indented under their parents.

Terminates processes by pkill firefox terminates all processes named


32 pkill
name or other attributes. firefox.

System Information

33 uname Prints system information. uname -a displays all system information.

Displays system
neofetch shows system information in a visually
34 neofetch information with an
appealing format.
aesthetic layout.

Displays disk space usage df -h shows disk space usage in a human-readable


35 df
of file systems. format.

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.

free -h shows memory usage in a human-readable


37 free Displays memory usage.
format.

Displays information about


38 lscpu lscpu
the CPU architecture.

Lists hardware
39 lshw sudo lshw
information.

Lists information about


40 lsblk lsblk
block devices.

User and Group Management

Displays the current


41 whoami whoami shows the username of the current user.
logged-in user.

Executes a command as
sudo apt-get update runs the apt-get update
42 sudo another user, typically the
command with superuser privileges.
superuser.

Switch to another user


43 su su - user switches to the user account.
account.

sudo useradd newuser adds a new user named


44 useradd Adds a new user.
newuser.

Adds a new user with a sudo adduser newuser interactively adds a new
45 adduser
more interactive interface. user named newuser.

Changes a user's passwd prompts to change the current user's


46 passwd
password. password.

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.

sudo groupadd newgroup creates a new group


49 groupadd Creates a new group.
named newgroup.

sudo groupdel groupname removes the specified


50 groupdel Deletes a group
group.

Displays group groups username shows all groups the specified


51 groups
membership for a user. user belongs to.

Displays user and group


id username shows user ID, group ID, and group
52 id information for a specified
memberships for the specified user.
user.

Network Configuration and Monitoring

Display network interface


ifconfig eth0 displays the configuration of the
53 ifconfig information. Configures
eth0 interface.
network interfaces.

Displays IP addresses and ip address show shows all IP addresses and


54 ip address
interfaces. network interfaces.

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.

ss -tuln shows listening sockets.


57 ss Displays socket statistics. ss -l4p displays all listening IPv4 sockets along with
the associated processes

in/harunseker/ 6
Traces the route packets traceroute google.com shows the route to
58 traceroute
take to a network host. google.com.

Connects to a remote ssh user@hostname connects to the remote


59 ssh
machine via SSH. machine hostname as user.

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

sudo apt install package installs the specified


package.

sudo apt remove package removes the specified


package.
Manages packages on
61 apt apt update update the package list
Debian-based systems.
apt upgrade upgrade installed packages to their
latest versions

apt dist-upgrade perform a comprehensive


system upgrade

sudo apt-get install package installs the


An older command-line
tool for package specified package.
62 apt-get
management on sudo apt-get remove package removes the
Debian-based systems.
specified package.

Package manager for sudo yum install package installs the


RPM-based Linux specified package.
63 yum
distributions (e.g., CentOS, sudo yum remove package removes the
RHEL). specified package.

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.

Low-level package rpm -i package.rpm installs an RPM package.


65 rpm manager for RPM-based rpm -e package removes an installed RPM
systems. package.

sudo dpkg -i package.deb installs a Debian


Low-level package package.
66 dpkg manager for Debian-based
systems. sudo dpkg -r package removes an installed
Debian package

sudo snap install package installs a snap


Universal Linux package package.
67 snap manager for containerized
applications. sudo snap remove package removes a snap
package.

sudo zypper install package installs the


Package manager for specified package.
68 zypper openSUSE and SUSE Linux
Enterprise. sudo zypper remove package removes the
specified package.

Other Commands

Creates hard and symbolic ln -s target linkname creates a symbolic link


69 ln
links. named linkname pointing to target.

70 clear Clears the terminal screen. clear clears the terminal display.

Exits the current shell or


71 exit exit logs out of the current session.
session.

Displays information about


72 finger finger user shows details about user.
system users.

in/harunseker/ 8
Displays the manual page
73 man man ls shows the manual for the ls command.
for a command.

Displays a brief description whatis ls provides a short description of the ls


74 whatis
of a command. command.

Transfers data from or to a curl -O http://example.com/file.txt


75 curl
server. downloads file.txt from the specified URL.

Compresses files into a zip zip archive.zip file1 file2 compresses file1
76 zip
archive. and file2 into archive.zip.

Extracts files from a zip


77 unzip unzip archive.zip extracts files from archive.zip.
archive.

resolvectl Shows the current DNS resolvectl status displays the DNS configuration
78
status settings. and status.

Configures packet filtering


79 iptables sudo iptables -L lists all current iptables rules.
rules.

Manages firewall with


80 ufw sudo ufw enable enables the firewall.
Uncomplicated Firewall.

81 cal Displays a calendar. cal shows the current month's calendar.

Manages systemd systemctl status nginx shows the status of the


82 systemctl
services. nginx service.

Displays the command history shows the list of previously executed


83 history
history. commands.

in/harunseker/ 9
dig example.com retrieves DNS information for
84 dig Queries DNS servers.
example.com.

host example.com shows the IP address of


85 host Performs DNS lookups.
example.com.

Displays and modifies the


86 arp arp -a shows the current ARP table.
ARP table.

Configures wireless iwconfig wlan0 shows the configuration of the


87 iwconfig
network interfaces. wlan0 wireless interface.

Displays or sets the


88 hostname hostname shows the current hostname.
system's hostname.

Queries the WHOIS


whois example.com retrieves WHOIS information for
89 whois database for domain
example.com.
information.

90 reboot Reboots the system. sudo reboot restarts the system.

Shuts down or reboots the sudo shutdown -h now shuts down the system
91 shutdown
system. immediately.

in/harunseker/ 10

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy