githubEdit

Linux

Linux Commands List

The commands found in the downloadable cheat sheet are listed below.

Hardware Information

Show bootup messages:

dmesg

See CPU information:

cat /proc/cpuinfo

Display free and used memory with:

free -h

List hardware configuration information:

lshw

See information about block devices:

lsblk

Show PCI devices in a tree-like diagram:

lspci -tv

Display USB devices in a tree-like diagram:

lsusb -tv

Show hardware information from the BIOS:

Display disk data information:

Conduct a read-speed test on device/disk:

Test for unreadable blocks on device/disk:

Searching

Search for a specific patternarrow-up-right in a file with greparrow-up-right:

Recursively search for a pattern in a directory:

Find all files and directories related to a particular name:

List names that begin with a specified character [a] in a specified location [/folder/location] by using the find commandarrow-up-right:

See files larger than a specified size [+100M] in a folder:

Note: Some commands are not recommended to use. Learn about them in our list of dangerous Linux commandsarrow-up-right.

File Commands

List files in the directory:

List all files (shows hidden filesarrow-up-right):

Show directory you are currently working in:

Create a new directoryarrow-up-right:

Remove a filearrow-up-right:

Remove a directory recursively:

Recursively remove a directory without requiring confirmation:

Copy the contents of one filearrow-up-right to another file:

Recursively copy the contents of one file to a second file:

Rename [file_name1] to [file_name2] with the command:

Create a symbolic linkarrow-up-right to a file:

Create a new file using toucharrow-up-right:

Show the contents of a file:

or use the cat commandarrow-up-right:

Append file contents to another file:

Display the first 10 lines of a file with:

Show the last 10 lines of a file:

Encrypt a file:

Decrypt a file:

Show the number of words, lines, and bytes in a file:

Note: Want to read more about file creation? Check out an article about how to create a file in Linux using the command linearrow-up-right.

Directory Navigation

Move up one level in the directory tree structure:

Change directory to $HOME:

Change location to a specified directory:

File Compression

Archive an existing file:

Extract an archived filearrow-up-right:

Create a gzip compressed tar file by running:

Compress a file with the .gz extension:

Note: For a more comprehensive overview of how to use tar refer to our guide tar Command in Linux With Examplesarrow-up-right.

File Transfer

Copy a file to a serverarrow-up-right directory securely:

Synchronize the contents of a directory with a backup directory using the rsync commandarrow-up-right:

Users

See details about the active users:

Show last system logins:

Display who is currently logged into the system with the who commandarrow-up-right:

Show which users are logged in and their activity:

Add a new group by typing:

Add a new user:

Add a user to a group:

Temporarily elevate user privileges to superuser or root using the sudo commandarrow-up-right:

Delete a user:

Modify user information with:

Note: If you want to learn more about users and groups, take a look at our article on how to add a user to a group in Linuxarrow-up-right.

Package Installation

List all installed packagearrow-up-rights with yum:

Find a package by a related keyword:

Show package information and summary:

Install a package using the YUM package manager:

Install a package using the DNF package manager:

Install a package using the APT package managerarrow-up-right:

Install an .rpm package from a local file:

Remove an .rpm package:

Install software from source code:

Process Related

See a snapshot of active processes:

Show processes in a tree-like diagram:

Display a memory usage map of processes:

See all running processes:

Terminate a Linux processarrow-up-right under a given ID:

Terminate a process under a specific name:

Terminate all processes labelled "proc”:

List and resume stopped jobs in the background:

Bring the most recently suspended job to the foreground:

Bring a particular job to the foreground:

List files opened by running processes:

Note: If you want to learn more about shell jobs, how to terminate jobs or keep them running after you log off, check out our article on how to use disown commandarrow-up-right.

System Information

Show system information:

See kernel release informationarrow-up-right:

Display how long the system has been running, including load average:

See system hostname:

Show the IP address of the system:

List system reboot history:

See current time and date:

Query and change the system clock with:

Show current calendar (month and day):

List logged in users:

See which user you are using:

Show information about a particular user:

Disk Usage

You can use the df and du commands to check disk space in Linuxarrow-up-right.

See free and used space on mounted systems:

Show free inodes on mounted filesystems:

Display disk partitions, sizes, and types with the command:

See disk usage for all files and directoryarrow-up-right:

Show disk usage of the directory you are currently in:

Display target mount point for all filesystem:

Mount a device:

SSH Login

Connect to host as user:

Securely connect to host via SSH default port 22:

Connect to host using a particular port:

Connect to host via telnet default port 23:

Note: For a detailed explanation of SSH Linux Commands, refer to our 19 Common SSH Commands in Linuxarrow-up-right tutorial.

File Permission

Chown command in Linuxarrow-up-right changes file and directory ownership.

Assign read, write, and execute permission to everyone:

Give read, write, and execute permission to owner, and read and execute permission to group and others:

Assign full permission to owner, and read and write permission to group and others:

Change the ownership of a file:

Change the owner and group ownership of a file:

Note: To learn more about how to check and change permissions, refer to our Linux File Permission Tutorialarrow-up-right.

Network

List IP addresses arrow-up-rightand network interfaces:

Assign an IP address to interface eth0:

Display IP addresses of all network interfaces with:

See active (listening) ports with the netstat commandarrow-up-right:

Show tcp and udp ports and their programs:

Display more information about a domain:

Show DNS information about a domain using the dig commandarrow-up-right:

Do a reverse lookup on domain:

Do reverse lookup of an IP address:

Perform an IP lookup for a domain:

Show the local IP address:

Download a file from a domain using the wget commandarrow-up-right:

Linux Keyboard Shortcuts

Kill process running in the terminal:

Stop current process:

The process can be resumed in the foreground with fg or in the background with bg.

Cut one word before the cursor and add it to clipboard:

Cut part of the line before the cursor and add it to clipboard:

Cut part of the line after the cursor and add it to clipboard:

Paste from clipboard:

Recall last command that matches the provided characters:

Run the previously recalled command:

Exit command history without running a command:

Run the last command again:

Log out of current session:

Last updated

Was this helpful?