100+ Linux commands for Ubuntu
Boost your Linux skills with our essential guide to over 100 commands for Ubuntu! Easily explore different categories to find the perfect commands that will save you time and boost your command-line efficiency, making your Linux experience more powerful and streamlined.
Action | Command |
---|---|
Permissions {0 = ---} | {1 = --x} | {2 = -w-} | {3 = -wx} | {4 = r--} | {5 = r-x} | {6 = rw-} | {7 = rwx}⚡ | |
Repeats the last command⚡ | !! |
Show current directory⚡ | pwd |
Delete directory⚡ | rm -r [dir] |
Create symbolic link to file⚡ | ln -s [file] [link] |
Open or create a file using the Vi/Vim text editor⚡ | vi [file] |
Change the ownership of a file⚡ | chown [user_name] [file] |
Display a built-in manual for a command⚡ | man [command] |
Search for a package⚡ | apt search [package_name] |
Installs the package and dependencies⚡ | sudo apt install [package_name] |
{Colorfull} All running processes⚡ | {h}top |
Terminate a Linux process under a given ID⚡ | kill [process_id] |
Show the PID of a process⚡ | pidof [process_name] |
Connect to the host using a particular port⚡ | ssh -p [port] [user_name]@[host] |
Action | Command |
---|---|
Halts the current command | Ctrl + C |
Stops the current command | Ctrl + Z |
Brings to foreground | fg |
Sends to background | bg |
Logout | Ctrl + D |
Erases one word in the current line | Ctrl + W |
Erases the whole line | Ctrl + U |
Erases from the current cursor position to the end of the line | Ctrl + K |
Type to bring up a recent command | Ctrl + R |
Repeats the last command⚡ | !! |
Log out of current session | exit |
Clear the terminal screen | clear |
Move cursor to the start of the line | Ctrl + A |
Action | Command |
---|---|
List content of current directory {with hidden files} | ls {-al} |
Change directory | cd [dir] |
Change to home | cd |
Show current directory⚡ | pwd |
Create a directory | mkdir [dir] |
Delete File | rm [file] |
Delete directory⚡ | rm -r [dir] |
Force remove file | rm -f [file] |
Force remove directory | rm -rf [dir] |
Copy file1 to file2 | cp [file1] [file2] |
Rename or move file1 to file2 | mv [file1] [file2] |
Create symbolic link link to file⚡ | ln -s [file] [link] |
Create or update file | touch [file] |
Places standard input into file | cat > [file] |
Output the contents of file | more [file] |
Output the first 10 lines of file | head [file] |
Output the last 10 lines of file | tail [file] |
Display contents of a file page by page. | more [file] |
Show the contents of a file with navigation. | less [file] |
Open or create a file using the nano text editor | nano [file] |
Open or create a file using the Vi/Vim text editor⚡ | vi [file] |
Display directory size | du -sh |
Search for a file | find / -name [file_name] |
Show disk usage | df -h |
Find recently modified files | find / -mtime -1 |
Display file type | file [filename] |
Action | Command |
---|---|
Display a line of text | echo [text] |
Set an environment variable | export |
Create an alias for a command | alias [alias-name]='[command]' |
Postpone the execution of a command | sleep [time-interval] && [command] |
Create a job to be executed at a certain time (Ctrl+D to exit prompt after command) | at [hh:mm] |
View the current shell session ID | echo $$ |
List all running jobs | jobs |
Run a command without saving it to history | [command] & disown |
Action | Command |
---|---|
Assign an integer value to a variable | let "[variable_name]=[value]" |
Export a Bash variable | export [variable_name] |
Declare a Bash variable | declare [variable_name]="[value]" |
List names of all shell variables & functions | set [variable_name] |
Remove an environment variable | unset [variable_name] |
Display the value of a variable | echo ${variable_name} |
Action | Command |
---|---|
{0 = ---} | {1 = --x} | {2 = -w-} | {3 = -wx} | {4 = r--} | {5 = r-x} | {6 = rw-} | {7 = rwx}⚡ | |
[Owners][Groups][All Users] | [_ _ _][_ _ _][_ _ _] |
Assign read, write, and execute file permission to everyone (rwxrwxrwx) | chmod 777 [file] |
Change the ownership of a file⚡ | chown [user_name] [file] |
Change the owner and group ownership of a file | chown [user_name]:[group_name] [file] |
Change permissions recursively | chmod -R [permissions] [dir] |
Action | Command |
---|---|
Archive an existing file or directory | tar cf [archive.tar] [file/directory] |
Extract an archived file | tar xf [archive.tar] |
Create a .gz compressed tar archive | tar czf [archive.tar.gz] |
{De}Compress .gz files | g{un}zip [file_name.{gz}] |
Action | Command |
---|---|
Display a built-in manual for a command⚡ | man [command] |
Print the command history used in the terminal. | history |
Find files and directories that match the specified pattern in a specified location | find [path] -name [search_pattern] |
Search for a specific pattern in a file with grep | grep [search_pattern] [file_name] |
Locate all files and directories related to a particular name | locate [name] |
Find the source, binary, and manual page for a command | whereis [command] |
Connect via SSH protocol | ssh [user_name]@[host] |
Connect via SFTP protocol | sftp [user_name]@[host] |
Action | Command |
---|---|
Securely copy files between local and remote systems via SSH | scp [file_name] [user_name]@[host]:[remote_path] |
Connect to the host via SSH default port 22/23 | ssh [host] |
Connect to the host via Telnet default port 22/23 | telnet [host] |
Action | Command |
---|---|
{Colorfull} All running processes⚡ | {h}top |
Terminate a Linux process under a given ID⚡ | kill [process_id] |
Terminate a process under a specific name | pkill [process_name] |
Terminate all processes with a given label | killall [label] |
List processes based on the provided keyword. | pgrep [keyword] |
Show the PID of a process⚡ | pidof [process_name] |
List and resume stopped jobs in the background | bg |
Bring (most recent)/(particular) suspended job to the foreground | fg {[job]} |
List files opened by running processes | lsof |
Catch a system error signal in a shell script. Executes provided commands when the signal is caught | trap "[commands]" [signal] |
Pause the terminal or a Bash script until a running process is completed | wait |
Run a Linux process in the background | nohup [command] & |
Display system uptime | uptime |
Show current processes by user | ps -U [user] |
Action | Command |
---|---|
Connect to a remote host as a user via SSH | ssh [user_name]@[host] |
Securely connect to a host via SSH default port 22⚡ | ssh [host] |
Connect to the host using a particular port | ssh -p [port] [user_name]@[host] |
Generate SSH key pairs | ssh-keygen |
Start SSH server daemon | sudo service sshd start |