Linux Linux Tips

35 Basic Linux Commands

1) pwd command
Use the pwd command to find the path to your current working directory (folder).

2) The cal command
shows the calendar for the current month.

3) echo command
This command displays the text you entered. Very important in shell scripts.

4) date command
shows the current time and date.

6) id command
prints the user and group (UID and GID) of the current user.

7) clear command
This command cleans / refreshes the screen.

8) help command
each command, the ‘–help’ option displays the usage summary for that command.

9) whatis command
This command describes the command in one line.

11) ls command
This ls command is used to view directory contents.
ls -l displays a long list of files.
ls -a will show hidden files.

12) mkdir command

To create a directory, use the ‘mkdir’ command.

13) touch command
To create an empty file, use the touch command.

14) cp command
This command is used to copy cp command file and directory.

15) mv command
Use mv command move file and directory to another location.

16) rm command
This rm command is used to delete the file and directory inside them. If you want to delete the directory, use – rm -r as an alternative to rmdir.

17) rmdir command
If you want to delete a directory, use the rmdir command. However, rmdir only allows you to delete empty directories.

18) file command
file command determines the file type of a given file. For example:

19) cat command
‘Cat’ can be used to view the contents of a file.

20) grep command
lets you search through all the text in a given file. Shows all the rows containing the value you entered.

21) head command
shows the first 10 lines of a command file. -n can specify the number of rows to view.

22) tail command
shows the last 10 lines of a command file. -n can specify the number of rows to view.

23) wc command
This command counts the lines, words and letters in a given file.

The /etc/passwd file contains 35 lines, 57 words and 1698 characters.

24) ln command
is used in the ln command to create a link. links are a type of shortcut to other files.

There are two types of links, softlinks and hardlinks. If you want to create a softlink, use the -s option. In this example, both types of links are created for the usrlisting file.

25) vi /vim command
VI stands for visual editor. This is the file editor that comes with most linux distributions.
You can open a file with vi as follows:

26) last command
displays information about users entering and exiting the system. The following command is used to display only the top 10 lines.

27) wget command
You can download files from the Internet with the help of the wget command.

28) ping command
Use the ping command to check your connection status. For example, by simply entering “ping google.com“, the command can test whether you can connect to Google and measure response time.

29) locate command
You can use this command to find a file, like a search in windows

30) chmod command
is used to change read, write and execute files and directories.

31) chown command
This command allows to change file or directory ownership. For example, if chown prabath does sysadminlogo, the sysadminlogo owner will switch to prabath.

32) du -h command
shows the disk usage of the file “valid“.

33) df command
View disk usage of your system. For example:

34) history command
history shows the commands that have been entered into your terminal so far.

35) passwd command
Passwd command change password of the current user account.

I think you have learned basic Linux commands in few minutes. 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *