5/26/25, 3:34 PM List of most useful Linux commands
List of most useful Linux commands
Here you have a compilation of the most useful Linux commands, so you can make the most of
your favorite operating system.
Of course, there are many more, and countless possible combinations (some truly long and
impossible to remember). If you have any contributions, I would be happy to receive them.
Process and Job Control
Filter cheatsheet...
View Active Processes
Displays the processes that are running on the system.
ps aux
Terminate a Process
Ends a specified process by its PID.
kill PID
Run a Process in the Background
Sends a command to the background.
command &
List Background Jobs
Displays the processes that are in the background.
jobs
https://w w w .luisllamas.es/en/useful-linux-commands-list/ 1/9
5/26/25, 3:34 PM List of most useful Linux commands
Bring a Background Process to the Foreground
Restores a process to the foreground.
fg %n
System Information and Monitoring
View CPU and Memory Usage
Displays real-time CPU and memory usage of the system.
top
Detailed Memory Information
Shows details of memory usage.
free -h
Show Disk Space
Verifies disk space usage by partition.
df -h
System Information
Displays details about the operating system and hardware.
uname -a
https://w w w .luisllamas.es/en/useful-linux-commands-list/ 2/9
5/26/25, 3:34 PM List of most useful Linux commands
View System Logs
Checks the system logs.
dmesg
File and Directory Operations
List Files
Lists the files in a directory, including hidden ones.
ls -la
Move Files or Directories
Moves files or directories to another location.
mv source destination
Copy Files
Copies files or directories.
cp file destination
Delete Files or Directories
Deletes files (or directories with the -r option).
rm file
https://w w w .luisllamas.es/en/useful-linux-commands-list/ 3/9
5/26/25, 3:34 PM List of most useful Linux commands
Create Directory
Creates a new directory.
mkdir directory_name
File Content Operations
Show File Content
Displays the content of a text file.
cat file
Show First Lines of a File
Displays the first 10 lines of a file.
head file
Show Last Lines of a File
Displays the last 10 lines of a file.
tail file
Concatenate and Show Files
Concatenates the content of files.
cat file1 file2
https://w w w .luisllamas.es/en/useful-linux-commands-list/ 4/9
5/26/25, 3:34 PM List of most useful Linux commands
View Real-Time Updates of a File
Displays the content of a file that is being updated, useful for logs.
tail -f file
File and Content Search
Find a File by Name
Searches for files by name in a directory and its subdirectories.
find /path -name "file_name"
Search Within File Content
Searches for a string of text in files within a directory.
grep "text" *.txt
Find Recently Modified Files
Finds files modified within a specific time range.
find /path -mtime -n
User and Group Management
Add a New User
Creates a new user on the system.
https://w w w .luisllamas.es/en/useful-linux-commands-list/ 5/9
5/26/25, 3:34 PM List of most useful Linux commands
sudo adduser username
Change a User’s Password
Changes a user’s password.
passwd username
Add a User to a Group
Adds a user to a specific group.
sudo usermod -aG group_name username
Delete a User
Removes a user from the system.
sudo deluser username
Permissions and Special Attributes
Change Permissions of a File
Changes the permissions of a file or directory (read, write, execute).
chmod 755 file
Change the Owner of a File
Changes the owner and group of a file.
chown user:group file
https://w w w .luisllamas.es/en/useful-linux-commands-list/ 6/9
5/26/25, 3:34 PM List of most useful Linux commands
View File Permissions
Displays permissions and details of files.
ls -l
Packaged and Compressed Files
Compress Files in tar.gz
Creates a compressed file in tar.gz format.
tar -czvf file.tar.gz file
Decompress tar.gz Files
Extracts files from a tar.gz file.
tar -xzvf file.tar.gz
Compress Files in zip
Creates a compressed file in zip format.
zip file.zip file
Decompress zip Files
Extracts files from a zip file.
unzip file.zip
https://w w w .luisllamas.es/en/useful-linux-commands-list/ 7/9
5/26/25, 3:34 PM List of most useful Linux commands
Package Managers and Repositories
Update Repositories
Updates the list of available packages.
sudo apt update
Install a Package
Installs a package from the repositories.
sudo apt install package_name
Remove a Package
Uninstalls a package from the system.
sudo apt remove package_name
Upgrade the Entire System
Upgrades all installed packages to the latest version.
sudo apt upgrade
File System Operations
Mount a File System
Mounts a device or partition to a directory.
sudo mount /dev/device /mount_point
https://w w w .luisllamas.es/en/useful-linux-commands-list/ 8/9
5/26/25, 3:34 PM List of most useful Linux commands
Unmount a File System
Unmounts a device or partition.
sudo umount /dev/device
View Mounted File Systems
Displays the currently mounted file systems.
mount
Format a Partition
Formats a partition to a specific file system.
sudo mkfs -t ext4 /dev/device
https://w w w .luisllamas.es/en/useful-linux-commands-list/ 9/9
5/26/25, 3:35 PM Linux Commands - Process and Job Control
Linux Commands -
Process and Job Control
I present to you a compilation of the most useful Linux commands about Process and Job Control
Run commands and applications
Filter cheatsheet...
Run application in current folder
Runs a program located in the current directory.
./application
Run command
Executes a command in the terminal.
command
Start process in background
Runs a command in the background, allowing you to continue using the terminal.
command &
Cancel command
Stops the execution of a running command.
Ctrl + C
https://w w w .luisllamas.es/en/linux-process-commands/ 1/6
5/26/25, 3:35 PM Linux Commands - Process and Job Control
Send command to background
Suspends a foreground command and sends it to the background.
Ctrl + Z
Retrieve process sent to background
Resumes a background process in the terminal.
bg
Bring job to foreground
Moves a specific job from the background to the foreground.
fg jobID
Start command as root
Executes a command with superuser privileges.
sudo command
Start executable with graphical interface as root
Runs a graphical application with superuser privileges.
sudo executable
Multiple session manager in terminal
Allows managing multiple sessions in the terminal.
https://w w w .luisllamas.es/en/linux-process-commands/ 2/6
5/26/25, 3:35 PM Linux Commands - Process and Job Control
screen -S session_name
Stop a screen session
Allows you to disconnect a screen session without ending it.
Ctrl + A, D
List processes and tasks
Show background processes with jobID and PID
Displays background processes and their identifiers.
jobs -l
Show processes
Lists all running processes on the system.
ps
Show active processes
Displays all active processes with detailed information.
ps -eafw
Show system process tree
Visually represents the process hierarchy.
pstree
https://w w w .luisllamas.es/en/linux-process-commands/ 3/6
5/26/25, 3:35 PM Linux Commands - Process and Job Control
Show processes ordered by memory usage
Lists processes sorted by memory usage.
ps aux | sort -k 5
Show detailed information of a specific process
Displays details about a particular process using its PID.
ps -p PID -o pid,comm,%cpu,%mem,etime
Monitor processes in real time
Displays active processes in real time.
top
Check the status of a process
Checks the status of a specific process (Running, Stopped, etc.).
ps -o stat= -p PID
Change the priority of a process
Modifies the priority of a running process.
renice -n new_priority -p PID
Send signal to a process
Sends a specific signal to a process to control it.
https://w w w .luisllamas.es/en/linux-process-commands/ 4/6
5/26/25, 3:35 PM Linux Commands - Process and Job Control
kill -s SIGNAL PID
Terminate processes
Terminate process to reload configuration
Sends a signal for a process to reload its configuration.
kill -1 Process_ID
Forcefully terminate process by PID
Ends a process forcefully using its ID.
kill -9 PID
Terminate process by name
Closes all processes that match a specific name.
killall -9 name
Remove all processes of a specific user
Closes all processes of a given user.
kill -u username
Command aliases
Set a temporary alias for command
https://w w w .luisllamas.es/en/linux-process-commands/ 5/6
5/26/25, 3:35 PM Linux Commands - Process and Job Control
Creates an alias that lasts only for the current session.
alias cmd='command'
Remove alias
Deletes a previously defined alias.
unalias cmd
Set a permanent alias
Adds an alias to your .bashrc or .bash_profile file to make it available in every session.
echo "alias cmd='command'" >> ~/.bashrc
source ~/.bashrc
Search for a process by name
Locates a specific process by its name.
pgrep process_name
Show resource usage of a specific process
Displays the resource usage (CPU, memory) of a particular process.
pmap PID
https://w w w .luisllamas.es/en/linux-process-commands/ 6/6
5/26/25, 3:36 PM Linux Commands - System Information and Monitoring
Linux Commands - System
Information and Monitoring
I present to you a compilation of the most useful Linux commands for System Information and
Monitoring
General Information
Filter cheatsheet...
Clear terminal screen
Clears the terminal screen, just like the shortcut Control + L .
clear
Reset terminal session
Resets the current terminal session.
reset
End terminal session
Closes the local or remote (SSH) terminal session and terminates initiated processes.
exit
Resource Management
Show running tasks
https://w w w .luisllamas.es/en/linux-information-commands/ 1/7
5/26/25, 3:36 PM Linux Commands - System Information and Monitoring
Displays a list of running tasks and their resource usage.
top
Show tasks with enhanced resources
Displays more detailed and visual information about running tasks.
htop
RAM status
Displays the status of RAM in megabytes.
free -h
Disk Space
List mounted partitions
Displays a list of the partitions mounted on the system.
df -h
View partition information on the system
Displays information about the partitions and their usage.
lsblk
Size of files and directories
Displays the size of files and directories sorted by size.
https://w w w .luisllamas.es/en/linux-information-commands/ 2/7
5/26/25, 3:36 PM Linux Commands - System Information and Monitoring
ls -lSr | more
Space used by a directory
Estimates the space used by the directory dir1 .
du -sh directory
Size sorted of files and directories
Displays the size of files and directories sorted by size.
du -sk * | sort -rn
System Information
Data of connected users
Displays information about users connected to the system.
who -a
View CPU usage details
Displays CPU usage details for each core.
mpstat -P ALL
Reboot history
Displays the system’s reboot history.
last reboot
https://w w w .luisllamas.es/en/linux-information-commands/ 3/7
5/26/25, 3:36 PM Linux Commands - System Information and Monitoring
System architecture and version
Displays the architecture and version of Linux and the kernel.
uname -a
Loaded kernel
Displays the currently loaded kernel.
lsmod
System hardware components
Displays information about the system hardware.
dmidecode -q
List hard drive partitions
Displays the partitions configured on the system.
cat /etc/fstab
Hard drive features
Displays specific features of the hard drive.
hdparm -i /dev/hda
Show PCI devices
Displays a list of connected PCI devices.
https://w w w .luisllamas.es/en/linux-information-commands/ 4/7
5/26/25, 3:36 PM Linux Commands - System Information and Monitoring
lspci
Show USB devices
Lists the USB devices connected to the system.
lsusb
Kernel loading process events
Displays events during the kernel loading.
tail /var/log/dmesg
System events
Displays logged system events.
tail /var/log/messages
Open files by processes
Displays the list of open files by the current process.
lsof -p $$
Open files in a directory
Displays open files in a specific directory.
lsof /directory
System calls
https://w w w .luisllamas.es/en/linux-information-commands/ 5/7
5/26/25, 3:36 PM Linux Commands - System Information and Monitoring
Displays the system calls made by a process.
strace -c ls >/dev/null
Library calls
Displays the library calls of a specific process.
strace -f -e open ls >/dev/null
Real-time interrupts
Displays system interrupts in real time.
watch -n1 'cat /proc/interrupts'
System Shutdown and Restart
Log out user
Ends the current user’s session.
logout
Shut down the system
Shuts down the system immediately.
shutdown now
Restart the system
Restarts the system immediately.
https://w w w .luisllamas.es/en/linux-information-commands/ 6/7
5/26/25, 3:36 PM Linux Commands - System Information and Monitoring
shutdown -r now
Scheduled shutdown
Schedules a shutdown for a specific hour and minute.
shutdown hours:minutes &
Cancel scheduled shutdown
Cancels a scheduled shutdown.
shutdown -c
Dates
Show system date
Displays the current system date.
date
Year calendar
Displays the calendar for a specific year.
cal year
Month and year calendar
Displays the calendar for a specific month and year.
cal month year
https://w w w .luisllamas.es/en/linux-information-commands/ 7/7
5/26/25, 3:36 PM Linux Commands - File and Directory Operations
Linux Commands - File
and Directory Operations
I present to you a compilation of the most useful Linux commands regarding File and Directory
Operations
In commands that require entering file or directory names, you can press tab twice to
autocomplete the path or get a list of available files.
Navigating Between Directories
Filter cheatsheet...
Go to root directory
cd
Go to previous directory
cd ..
Enter directory (absolute path)
cd /directory1/directory
Enter directory (relative path)
cd directory1/directory2
Go to user directory
cd ~
https://w w w .luisllamas.es/en/linux-files-and-directories-commands/ 1/4
5/26/25, 3:36 PM Linux Commands - File and Directory Operations
Go to last visited directory
cd -
Show current path
pwd
Listing Files and Directories
Show files and directories
ls
Show files and directories with details
ls -l
Show files and directories, including hidden ones
ls -a
Show files and directories sorted by modification date
ls -lt
Show files and directories in list format, including sizes
ls -lh
https://w w w .luisllamas.es/en/linux-files-and-directories-commands/ 2/4
5/26/25, 3:36 PM Linux Commands - File and Directory Operations
File and Directory Manipulation
Rename or move a file or directory
mv source destination
Copy a file
cp file destination
Copy a directory
cp -r source destination
Delete the file named file
rm file
Delete directory if it is empty
rm -d directory
Delete directory and its contents
rm -r directory
Create new directory
mkdir directory
Create multiple directories simultaneously
mkdir directory1 directory2
https://w w w .luisllamas.es/en/linux-files-and-directories-commands/ 3/4
5/26/25, 3:36 PM Linux Commands - File and Directory Operations
Create directory path
mkdir -p /directory1/directory2
Create empty file
touch file
Change file date (format year, month, day, and hour)
touch -t 19901230000 file
Symbolic Links
Create a symbolic link to the file or directory
ln -s file link1
Create a hard link to the file or directory
ln file link1
View details about a symbolic link
ls -l link1
https://w w w .luisllamas.es/en/linux-files-and-directories-commands/ 4/4
5/26/25, 3:36 PM Linux Commands - File Content Operations
Linux Commands - File
Content Operations
I present to you a compilation of the most useful Linux commands for File Content Operations
Pipes and I/O Redirections
Filter cheatsheet...
Redirect command output to a new file
Use the > operator to send the output of a command to a new file.
command > output_file.txt
Append command output to an existing file
Use >> to append the output to a file without overwriting it.
command >> output_file.txt
Redirect command input
Use < to take input from a file instead of standard input.
command < input_file.txt
Redirect standard output and error output to a file
Use &> to capture both types of output in a single file.
command &> output_file.txt
https://w w w .luisllamas.es/en/linux-file-content-commands/ 1/3
5/26/25, 3:36 PM Linux Commands - File Content Operations
Pipe: direct output of one command as input to another
Use | to connect two commands, where the output of the first becomes the input of the
second.
command1 | command2
Show file content
Show content of a file
Use cat to view the entire content of a file.
cat file
Show content of a file starting from the end
Use tac to display the content in reverse order.
tac file
Scroll line by line through the file
Use more to read the file in segments.
more file
Scroll forward or backward in the file
Use less for more flexible navigation through the file’s content.
less file
https://w w w .luisllamas.es/en/linux-file-content-commands/ 2/3
5/26/25, 3:36 PM Linux Commands - File Content Operations
Show the first two lines of a file
Use head with the number of lines you want to display.
head -2 file
Show the last two lines of a file
Use tail to see the last lines of a file.
tail -2 file
Show the last lines of a file in real-time (follow)
Use tail -f to monitor changes in real-time.
tail -f file
https://w w w .luisllamas.es/en/linux-file-content-commands/ 3/3
5/26/25, 3:37 PM Linux Commands - File and Content Search
Linux Commands - File
and Content Search
I present to you a compilation of the most useful Linux commands for File Search and its content
Search Files
Filter cheatsheet...
Search for files and directories by name throughout the system
Search for files and directories by name in the filesystem.
find * -name name
Search for files and directories by name within a directory
Perform the search for files and directories within a specific directory.
find directory -name name
Search for files and directories belonging to a user within a directory
Find files and directories that belong to a specific user.
find directory -user user
Search for files and directories by type within a directory
Search for files and directories of a specific type (d: directory, f: regular file, l: symbolic link).
find directory -type f
https://w w w .luisllamas.es/en/linux-search-commands/ 1/2
5/26/25, 3:37 PM Linux Commands - File and Content Search
Search for files and execute a command
Execute a command on the found files.
find directory -name name -exec command {} \;
Search for files with .ps extension
Use locate to find files with a specific extension.
locate \*.ps
Show the full path of an executable
Find the location of an executable in the system.
which executable
Show the location of a binary, help, or source file
Use whereis to get information about the executable file.
whereis executable
Show files that contain a specific name
Search for files that contain a specific part in their name.
find directory -iname "*part_name*"
https://w w w .luisllamas.es/en/linux-search-commands/ 2/2
5/26/25, 3:37 PM Linux Commands - User and Group Management
Linux Commands - User
and Group Management
I present to you a compilation of the most useful Linux commands for User and Group
Management
Users
Filter cheatsheet...
Create a new user
Creates a basic user on the system.
useradd usuario
Create user with full option
Allows specifying additional information such as name, group, home directory, and shell.
useradd -c "User Name" -g group -d /home/user -s /bin/bash usuario
Delete user
Removes a user from the system.
userdel usuario
Delete user and remove their home directory
Removes a user and their associated personal directory.
userdel -r usuario
https://w w w .luisllamas.es/en/linux-users-commands/ 1/4
5/26/25, 3:37 PM Linux Commands - User and Group Management
Change user attributes
Modifies the information of an existing user.
usermod -c "User name" -g group -d /home/user -s /bin/bash usuario
Change the password of the user themselves
Allows the user to change their own password.
passwd
Change the password of another user
Allows the root user to change the password of another user.
passwd usuario
Set an expiration date for the user password
Establishes a specific date when the user password will no longer be valid.
chage -E 2014-12-31 usuario
View information about the user
Displays details about the user, such as groups they belong to.
id usuario
List users
Displays all users on the system.
https://w w w .luisllamas.es/en/linux-users-commands/ 2/4
5/26/25, 3:37 PM Linux Commands - User and Group Management
cat /etc/passwd
User Groups
Create user group
Creates a new group on the system.
groupadd group_name
Delete user group
Removes a group from the system.
groupdel group_name
Rename user group
Changes the name of an existing group.
groupmod -n new_name old_name
Modify the current group of a user
Changes the active group of the current user who belongs to multiple groups.
newgrp group
List groups of the current user
Displays the groups to which the current user belongs.
groups
https://w w w .luisllamas.es/en/linux-users-commands/ 3/4
5/26/25, 3:37 PM Linux Commands - User and Group Management
List all groups
Displays all groups defined on the system.
cut -d: -f1 /etc/group
Add user to an existing group
Adds a user to a specific group.
usermod -aG group_name usuario
Remove user from a group
Removes a user from a specific group.
gpasswd -d usuario group_name
https://w w w .luisllamas.es/en/linux-users-commands/ 4/4
5/26/25, 3:38 PM Linux Commands - Permissions and Special Attributes
Linux Commands - Permissions
and Special Attributes
I present to you a collection of the most useful Linux commands regarding Permissions and
special attributes
File and folder permissions
Filter cheatsheet...
Show permissions
To view the permissions of files and directories in a readable format.
ls -lh
Assign 0777 permissions to a file
Allows read, write, and execute for everyone.
chmod 0777 file
Modify permissions of a directory
Assigns read and write permissions to all files within a directory.
chmod -R 0644 directory
Set permissions on a directory
Add or remove read (r), write (w), and execute (x) permissions for the owner (u), group (g), and
others (o).
chmod ugo+rwx directory
https://w w w .luisllamas.es/en/linux-permissions-commands/ 1/4
5/26/25, 3:38 PM Linux Commands - Permissions and Special Attributes
Change owner of a file
Changes the owner of a specific file.
chown user file
Change owner for all files in a directory
Applies the ownership change to all files in a directory.
chown -R user directory
Change group of a file
Modifies the group of a file.
chgrp group file
Change user and group of a file
Sets both the owner and the group for a file.
chown user:group file
SUID permissions
View files with SUID
Shows all system files that have the SUID bit set.
find / -perm -u+s
https://w w w .luisllamas.es/en/linux-permissions-commands/ 2/4
5/26/25, 3:38 PM Linux Commands - Permissions and Special Attributes
Set SUID bit on a binary file
Allows the user executing this file to have the same privileges as the owner.
chmod u+s /bin/file
Remove SUID bit from a binary file
Removes the SUID bit from a file.
chmod u-s /bin/file
Set SGID bit on a directory
Assigns the SGID bit to a directory, similar to SUID, but for directories.
chmod g+s /home/directory
Remove SGID bit from a directory
Removes the SGID bit from a directory.
chmod g-s /home/directory
Set STICKY bit on a directory
Allows the deletion of files only by their rightful owners.
chmod o+t /home/directory
Remove STICKY bit from a directory
Removes the STICKY bit from a directory.
https://w w w .luisllamas.es/en/linux-permissions-commands/ 3/4
5/26/25, 3:38 PM Linux Commands - Permissions and Special Attributes
chmod o-t /home/directory
https://w w w .luisllamas.es/en/linux-permissions-commands/ 4/4
5/26/25, 3:38 PM Linux Commands - Packaged and Compressed Files
Linux Commands - Packaged
and Compressed Files
I present to you a compilation of the most useful Linux commands regarding Packaged and
Compressed Files
TAR Files
Filter cheatsheet...
Show content of TAR file
To view the contents of a .tar file without extracting it.
tar -tf archive.tar
Create TAR file
Generates a TAR file from a directory.
tar -cvf archivo.tar directorio1
Create TAR file with multiple files and directories
Allows you to package multiple files and directories into a single TAR file.
tar -cvf archivo.tar archivo1 archivo2 directorio1
Create compressed TAR file in bzip2
Generates a compressed TAR file using the bzip2 algorithm.
tar -cvfj archivo.tar.bz2 directorio1
https://w w w .luisllamas.es/en/linux-compression-commands/ 1/4
5/26/25, 3:38 PM Linux Commands - Packaged and Compressed Files
Create compressed TAR file in gzip
Creates a TAR file compressed in gzip format.
tar -cvfz archivo.tar.gz directorio1
Extract TAR file
Decompresses a TAR file.
tar -xvf archivo.tar
Extract TAR file to a specific directory
Extracts the contents of a TAR file to the desired directory.
tar -xvf archivo.tar -C /directorio
Extract TAR file preserving user permissions
Extracts a TAR file while preserving user permissions.
tar -xpvf archivo.tar
Decompress bzip2 compressed TAR file
Extracts a TAR file that has been compressed with bzip2.
tar -xvfj archivo.tar.bz2
Decompress gzip compressed TAR file
Extracts a TAR file compressed in gzip format.
https://w w w .luisllamas.es/en/linux-compression-commands/ 2/4
5/26/25, 3:38 PM Linux Commands - Packaged and Compressed Files
tar -xvfz archivo.tar.gz
ZIP Files
Create a compressed ZIP file
Generates a ZIP file from a directory.
zip archivo.zip directorio1
Compress in ZIP with multiple files and directories
Allows you to package multiple files and directories into a single ZIP file.
zip -r archivo.zip archivo1 archivo2 directorio1
Decompress a ZIP file
Extracts the contents of a ZIP file.
unzip archivo.zip
BZ2 Files
Compress BZ2 file
Generates a compressed file in BZ2 format.
bzip2 archivo
Decompress BZ2 file
https://w w w .luisllamas.es/en/linux-compression-commands/ 3/4
5/26/25, 3:38 PM Linux Commands - Packaged and Compressed Files
Extracts the contents of a BZ2 file.
bunzip2 archivo.bz2
GZ Files
Compress GZ file
Generates a compressed file in GZ format.
gzip archivo
Decompress GZ file
Extracts the contents of a GZ file.
gunzip archivo.gz
Decompress GZ file with maximum compression
Decompresses a GZ file applying the maximum compression.
gzip -9 archivo
https://w w w .luisllamas.es/en/linux-compression-commands/ 4/4