Linux Ubuntu is probably one of the most user-friendly Linux operating systems out there. You can run it on a regular computer as well as install it on a server. The user interface resembles that of Windows and it's very easy to understand and navigate. Often, users may have to use the Terminal Command line environment to navigate and do their operations, in which case they need to learn some basic Terminal Commands. This article covers the most basic, frequently used Terminal Commands in Linux Ubuntu.
Terminal commands are built into the Linux Operating system. These commands can be used to control the computer and run various functions. New users of Linux Ubuntu can use these terminal commands to get a better understanding of how the operating system works.
Basic Terminal Commands used in Linux Systems (Ubuntu):
| Commands | Usage |
|---|---|
| Ctrl Alt t | to open the terminal |
| Ctrl Shift + | zoom in |
| ctrl - | zoom out |
| ls | to display the contents of that particular folder |
| ls-1 | to display one file per line |
| ls-a | to display all files along with the hidden files as well |
| - | short option |
| -- | long option |
| clear | command to clear the terminal screen |
| exit | for closing the terminal |
| pwd | present working directory |
| ls-l | gives long listing commands |
| ls-f | differentiate between the files |
| ls-r | get display in reverse format |
| ls-R | to get recursive directory structure |
| man | to access man page/manual page |
| q | to quit from man page |
| -p | to create parent directory |
| rm | remove files, empty directories and non-empty directories |
| cd | change directory (to navigate from one directory to another) |
| cd- | will take you to previous working directory |
| vi or vim | visual editor |
| Esc :set nu | to enable line numbers |
| Esc :set nonu | to disable line numbers |
| Esc G | to go to last line of file |
| Esc dd | to delete current line |
| Esc 2dd | it deletes two lines from the cursor pointer |
| Esc D | delete the current line except serial number |
| Esc u | undo |
| Esc Ctrl r | redo |
| Esc yy | copy that particular line |
| Esc P | paste the previously copied line |
| Esc dw | to delete the current word upon which the cursor is on |
| Esc d $ | will delete the whole line |
| Esc ^ | goes to first character of the line |
| Esc gg | to go to first character of file |
| Esc $ | last character of line |
| Esc G | last line of the file |
| Esc A | append the end of line |
| Esc a | append the next character from the cursor |
| Esc o | opens a line below |
| Esc O | opens a line above |
| Esc r | replace single character |
| Esc R | replace multiple characters in line |
| Esc i | insert character at the cursor |
| Esc I | insert character to beginning of the line |
| Esc :wq | to write the content to the file and quit |
| Esc :q | quit without saving |
| Esc :w | saves your file contents |
| cat | display all the contents in a file |
| cp | copy |
| mv | move |
| hw info | get hardware commands |
| -c | used for displaying the number of characters in a file |
| wc | word count |
| expr | to evaluate an expression |
| bc | to solve decimal numbers (bc stands for basic calculator) |
| scale | to display the decimal part |
| sort | to sort the data in a file |
| less | to display the contents page-by-page |
| more | to display the contents page-by-page |
| cut | cutting a particular field |
| -d | delimiter |
| &> | to store output and error at a same time |
| > | stores the outpot and it overwrites |
| >> | appends the output |
| 2> | to store the error |
| 2>> | append the error |
| &>> | appends both output and error |
| ; | used for separating two commands in a single line |
| export | used for creating environment variables |
| env print enu | used to print all environment variables |
| -e | enables interpretation of escape characters |
| ` ` | used for getting specific result (back tick) |
| -eq | compare if two numbers are equal |
| -ge | compare if one number is greater than or equal to num |
| -le | compare if one number is less than or equal to num |
| -ne | compare if two numbers are not equal |
| -lt | compare if one number is lesser than another number |
| -gt | compare if one number is greater than another number |
| = | compare if two strings are equal |
| != | compare if two strings are not equal |
| -n | evaluate if string length is greater than zero |
| -z | evaluate if string length is equal to zero |
| ! | (not gate) compare if two strings are equal |
| -a | (AND Gate) Logically AND two logical expression |
| -o | (OR Gate) Logically OR two logical expression |
| seq | to generate some sequence of numbers |
| head | helps us to output the first part of files |
| tail | helps us to output the last part of files |
| $@ or $* | used to get all arguments |
| $# | to get the count of arguments |
| $1 | first argument |
| $2 | second argument |
| $0 | script name |
| uniq | will delete the duplicate elements from the file |
| tr | to transfer (i.e. a>A or A>a) |
| -s | file test operator |
| user add or add user | to add a new user |
| user del or del user | to delete the user |
| man tail | to open the tail user command window |
| du | helps to estimate file space usage |
| df | helps to find system disk space usage |
| stat | helps to display file system status |
| Ln | helps to make links between file |
| su | to change user id or become superuser |
| w | shows who is logged on and what they are doing |
| who | shows who is logged on |
| whoami | prints effective user id |
| scp | secure copy (remote file copy program) |
| passwd | to change current user password |
| ssh | open SSH SSH client (remote login program) |
| if config | to configure a network interface |
| ping | send ICMP ECHO_REQUEST to network hosts |
| cmp | to compare two files byte by byte |
| diff | to compare files line by line |
| chmod | used to change file mode bits |
| chown | used to file owner and group |
| find | to search for files in a directory hierarchy |
| grep | to print lines matching a pattern |
| sed | a stream editor for filtering and transforming text |
| split | used to split a file into pieces |
| tr | translates or deletes characters |
| dmesg | display the kernal boot-up message |
CONCLUSION:
The Linux terminal is an important part of the Linux operating system. It provides access to the basic functions of the computer and the ability to run commands. There are many basic commands used in the Linux terminal. In this blog, we discussed some basic terminal commands in Linux Ubuntu, which will help you to easily run various functions. These commands are also helpful for both, newbies and experienced users.
