Useful Linux Commands
Some of the most common and useful Linux commands.
Command | Description |
---|---|
man <tool> |
Opens man pages for the specified tool. |
<tool> -h |
Prints the help page of the tool. |
apropos <keyword> |
Searches through man pages' descriptions for instances of a given keyword. |
cat |
Concatenate and print files. |
whoami |
Displays current username. |
id |
Returns users identity. |
hostname |
Sets or prints the name of the current host system. |
uname |
Prints operating system name. |
pwd |
Returns working directory name. |
ifconfig |
The ifconfig utility is used to assign or view an address to a network interface and/or configure network interface parameters. |
ip |
Ip is a utility to show or manipulate routing, network devices, interfaces, and tunnels. |
netstat |
Shows network status. |
ss |
Another utility to investigate sockets. |
ps |
Shows process status. |
who |
Displays who is logged in. |
env |
Prints environment or sets and executes a command. |
lsblk |
Lists block devices. |
lsusb |
Lists USB devices. |
lsof |
Lists opened files. |
lspci |
Lists PCI devices. |
sudo |
Execute command as a different user. |
su |
The su utility requests appropriate user credentials via PAM and switches to that user ID (the default user is the superuser). A shell is then executed. |
useradd |
Creates a new user or update default new user information. |
userdel |
Deletes a user account and related files. |
usermod |
Modifies a user account. |
addgroup |
Adds a group to the system. |
delgroup |
Removes a group from the system. |
passwd |
Changes user password. |
dpkg |
Install, remove and configure Debian-based packages. |
apt |
High-level package management command-line utility. |
aptitude |
Alternative to apt . |
snap |
Install, remove and configure snap packages. |
gem |
Standard package manager for Ruby. |
pip |
Standard package manager for Python. |
git |
Revision control system command-line utility. |
systemctl |
Command-line based service and systemd control manager. |
ps |
Prints a snapshot of the current processes. |
journalctl |
Query the systemd journal. |
kill |
Sends a signal to a process. |
bg |
Puts a process into background. |
jobs |
Lists all processes that are running in the background. |
fg |
Puts a process into the foreground. |
curl |
Command-line utility to transfer data from or to a server. |
wget |
An alternative to curl that downloads files from FTP or HTTP(s) server. |
python3 -m http.server |
Starts a Python3 web server on TCP port 8000. |
ls |
Lists directory contents. |
cd |
Changes the directory. |
clear |
Clears the terminal. |
touch |
Creates an empty file. |
mkdir |
Creates a directory. |
tree |
Lists the contents of a directory recursively. |
mv |
Move or rename files or directories. |
cp |
Copy files or directories. |
nano |
Terminal based text editor. |
which |
Returns the path to a file or link. |
find |
Searches for files in a directory hierarchy. |
updatedb |
Updates the locale database for existing contents on the system. |
locate |
Uses the locale database to find contents on the system. |
more |
Pager that is used to read STDOUT or files. |
less |
An alternative to more with more features. |
head |
Prints the first ten lines of STDOUT or a file. |
tail |
Prints the last ten lines of STDOUT or a file. |
sort |
Sorts the contents of STDOUT or a file. |
grep |
Searches for specific results that contain given patterns. |
cut |
Removes sections from each line of files. |
tr |
Replaces certain characters. |
column |
Command-line based utility that formats its input into multiple columns. |
awk |
Pattern scanning and processing language. |
sed |
A stream editor for filtering and transforming text. |
wc |
Prints newline, word, and byte counts for a given input. |
chmod |
Changes permission of a file or directory. |
chown |
Changes the owner and group of a file or directory. |
Credit: HackTheBox.eu
Member discussion