8. echo
To fill a newly created file with content comes echo for use. With echo „read me“ > newfile you can redirect the output to a file. The individual > This causes any existing content to be overwritten. If you want to add a line to an existing file, use instead >>.
9. rm
If you want to delete a file, this is what comes up rm-Command to use (for example: rm myfile). However, you can only delete files that belong to you. To view the “Ownership” status (and many other details), use the command – ls -l. The output should look like the following example:
-rw-r--r--. 1 george george 8 Nov 6 13:28 newfile
In this example the rw-Part information that you (or george) have both read and write permissions.
10. mv
This is recommended for renaming a file mv-Command (for example: mv newfile oldfile). If you specify a complete file path, you can not only rename files, but also move them (assuming you have the appropriate write permissions).
To move a file to the /tmp directory, do the following:
mv newfile /tmp
If you want to move a file and rename it at the same time, this is how it works:
mv newfile /tmp/oldfile
11. cp
With the cp-Command copy files (for example: cp thisfile thatfile). To copy a file to another directory, simply specify the full path (for example: cp myfile /tmp/yourfile).
12. passwd
To change your password on Linux comes the passwd-Command to deploy. Once entered, you will be asked to enter both your old and new password twice. You should definitely remember this because it can only be reset with root access.
13. clear
With the clearcommand clean your terminal window. This can be useful for analyzing commands without distraction.
14. head
With the head-Command you go directly to the beginning of a text file. By default, ten lines are displayed.
15. tail
The tailcommand has the opposite effect and displays the last (ten) lines of a text file.
16. man
This is also particularly useful for beginners man-Command. It stands for “Manual” and provides information about what certain commands do and how they can be used. Try it out – for example with man pwd.
17. date
To display the current time and date, use this on Linux date-Command. The output has a format like the following example:
$ date
Sun Nov 10 01:32:00 PM EST 2024
18. cal
You can access a calendar view of the current month via the cal-command. To see a specific month, add it (and the corresponding year):
$ cal 03 1949
March 1949
Su Mo Tu We Th Fr Sa
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31
19. whoami
To display the user name associated with the currently used account, we recommend whoami-Command. Once you switch back and forth between multiple accounts, you’ll appreciate this command.
20. alias
Once you get used to Linux and start using more complex commands, it will alias-Command useful. With this command you can set up short names for commands that you use regularly. For example, if you instead clear only c If you want to enter this, do it like this:
$ alias c=clear
However, if you want this alias to be available after every new login, you must add it to your .bashrc file. It works like this:
$ echo “alias c=clear” >> .bashrc
At this point, be very careful not to accidentally overwrite the file by mistakenly typing just a > use.
21. history
If you want to keep track of which commands you last used, the Linux will help history-Command continues. The most recently used commands are displayed first, but this list can potentially contain up to 1,000 commands. To influence the number of commands displayed, proceed as follows:
$ echo $HISTSIZE
1000
22. grep
If you are looking for a specific word or string within a text file, you can use the grep-Command search for it.
$ grep alias ~/.bashrc
The ~/ causes in this example that .bashrc is searched for aliases – even if you are not in the home directory (~) condition.
23. sort
The sortcommand allows you to sort the contents of text files – as in the example below.
$ sort friends
Alice
Betty
Christopher
Diane
George
Patty
Ricky
Sam
Tim
24. mkdir
To create a new directory or a subdirectory in Home, use this mkdir-Command:
$ mkdir reports
25. ps
To view ongoing processes, use the ps-Command without arguments. In the example below, these are just the bash shell and that ps-Command itself:
$ ps
PID TTY TIME CMD
64681 pts/1 00:00:00 bash
68330 pts/1 00:00:00 ps
To view all processes currently running on the system, use one of the following commands (varies depending on the Linux distribution).
$ ps -ef
$ ps -aux
(fm)
Would you like to read more interesting articles on various topics from the IT world? Our free newsletters deliver everything IT professionals should know – straight to your inbox!
