Ubuntu is one of the most customizable Linux distributions available today. Almost all Linux enthusiasts start with Ubuntu. And if you’re new to Ubuntu, then check out this list of basic commands that will help you get acquainted with the system.
The commands will help you to perform some basic actions in the operating system. To help you get off to a good start, here are the top 18 basic Ubuntu commands for beginners.
The 18 Basic Ubuntu Commands Every Beginner Needs to Learn
1. sudo
The sudo (SuperUser DO) command allows you to run programs or other commands with administrative privileges, just like “Run as administrator” on Windows. Elr is useful when, for example, you need to modify files in a directory that your user would not normally have access to.
2. apt-get
The apt-get is one of the most important commands of Ubuntu, and that every beginner should know. It is used to install, update and remove any package. apt-get basically works on a database of available packages. Here is the list of different apt-get commands:
- sudo apt-get update
apt-get update with administrator privileges is the first command you need to run on any Linux system after a fresh install. This command updates the database and informs your system whether there are newer packages available or not.
- sudo apt-get upgrade
After updating the package database, the next step is to update the installed packages. To update all packages with available updates, you can use this command.
And if you like to update a particular package, you should tweak the above command a bit:
sudo apt-get upgrade package name . Replace the package name with the desired package.
- sudo apt-get install
Install ClamAV Antivirus in Debian 11 Bullseye and Ubuntu 20.04
If you know the package name, you can easily install a program using this command:
sudo apt-get install package name . Replace the package name with the desired package.
If you’re not sure what the package name is, you can type a few letters and press the tab and it will suggest all available packages with those letters, thanks to the autocomplete feature.
3. ls
The ls (list) command lists all files and folders in your current working directory. You can also specify paths to other directories if you want to see their contents.
4. cd
The cd (change director) command , also known as chdir, used to change the current working directory. It is one of the most used basic commands in Ubuntu. Using this command is easy, just type cd followed by the folder name. You can use full paths to folders or simply the name of a folder within the directory you are currently working on. Some common uses are:
- cd / – Takes you to the root directory.
- cd .. – Takes you to a directory level.
- cd – – Takes you to the previous directory.
Here are some examples of how to use the cd command in Ubuntu:
Example 1: cd home – open the home folder in the current directory.
Example 2: cd Linux Drive – open the Linux Drive folder in the directory.
5. pwd
The pwd (print working directory) command displays the full path of the current working directory.
6. cp
The cp (copy) command allows you to copy a file. You must specify both the file you want to copy and the location you want to copy it to – for example, cp xyz / home / myfiles copies the file “ xyz ” to the directory “/ home / myfiles “ .
7. mv
The mv (move) command allows you to move files. You can also rename files, moving them to the directory they are currently in, but with a new name. Usage is the same as cp-f or example mv xyz /home/ myfiles would move the file “ xyz ” to the directory “/home/ myfiles “ .
8. rm
The rm (remove) command removes the specified file.
- rmdir (“remove directory”) – Removes an empty directory.
- rm -r (“recursively remove”) – Removes a directory along with its contents.
9. mkdir
The mkdir (make directory) command allows you to create a new directory. You can specify where you want the directory to be created – if you don’t, it will be created in your current working directory.
10. history
The history command displays all your previous commands, up to the history limit.
11. df
The df (display filesystem) command displays disk space usage information for all mounted file systems.
12. du
The du (directory usage) command displays the size of a directory and all its subdirectories.
13. free
This command displays the amount of free space available on the system.
14. uname -a
The uname -a – command provides a wide range of basic information about the system.
15. top
The top command displays processes using the most system resources at any time. “Q” can be used to exit.
16. man
The man command displays a ” man page”. The man pages are generally very detailed, and it is recommended that you read the man pages for any commands you are not familiar with. Some uses are:
- man man – Provides information about the manual itself.
- man intro – Displays a brief introduction to Linux commands.
17. info
Similar to man, but generally provides more detailed or accurate information.
18. command name> -h or command name> -help
This command is a third alternative for getting help. While not as detailed as the information or manual pages, this will provide a quick overview of the command and its uses.
19. Htop
htop not comes by default with Ubuntu Linux, so first you need to install using following command
sudo apt install htop
htop, a cross-platform interactive process viewer. It is a text-mode application (for console or X terminals) and requires ncurses.
20. Neofetch
Neofetch ; A command-line system information tool written in bash 3.2+ also not comes by default in Ubuntu, so you need to install using following command
sudo apt install neofetch
Ubuntu shortcuts
To make your skill even easier, these Ubuntu keyboard shortcuts can help.
shortcuts | Occupation |
---|---|
Ctrl + Shift + T | Open new tab in current terminal |
Ctrl + Shift + W | close current tab |
Ctrl + A | Move cursor to beginning of line |
Ctrl + E | Move cursor to end of line |
Ctrl + U | Clear all current line |
Ctrl + K | Clears cursor right command |
Ctrl + W | Delete the word before the cursor |
Ctrl + R | Allows you to search your history for commands that match what you typed |
Ctrl + C | Copy current process |
Ctrl + Z | Suspend the current process by sending the SIGSTOP signal |
Ctrl + L | Clean the terminal output |
Alt+F | forward a word |
Alt + B | back one word |
Ctrl + Shift + C | Copy highlighted command to clipboard |
Ctrl + Shift + V or Shift + Insert | Paste the contents of the clipboard |
Up/Down arrow keys | To scroll through the command history, allowing you to quickly run the same command multiple times |
TAB | Used to complete the command you are typing. If more than one command is possible, you can press it multiple times to cycle through possible conclusions. If a very large number of commands is possible, it can display a list of all possible conclusions. |
I am pretty much a total GUI guy except for update and upgrade commands. I keep a good cheat sheet for seldom used needs.The one command I find essential is .
If apt crashes or their are dependency issues it is essential to fix the problem. Synaptic can fix some, but not all those issues.
sudo dpkg –configure -a
not sure what went wrong.
Ctrl+D works as “exit” command in terminal. For example Ctrl+ D D D D and you can close ssh session chain. from root somewhere. to closed terminal in your desktop.
Win- left/right/up/down – move and resize window to left/right side of screen, maximize or restore default position.