Basic & useful Linux commands
Shuts down the operating system
Shuts down & restarts the operating system
Clear the terminal
Open the manual page
This command opens the manual page for the command or utility specified.
Find files or directory
find / -name grub.conf
But this search took several minutes to complete because we have to search all directories and sub directories. So we can specify the directory.
find /etc -name grub.conf
Read the files
Read few lines of file
In default, The head command display top 10 lines of a file. But we can specify the number of lines.
head -n15 /etc/passwd
To display the last bottom lines of file, we have to use tail command.
Same like head command, we can specify the number of lines.
tail -n15 /etc/passwd
Copy content of a file
cp file1.txt file2.txt
cp command take the contents of one file and place a copy with the same or different name in the directory of our choice.
mv file1 file2
Search term through a file
grep 'vickey' /etc/passwd
Count the word
The command output will be in number of lines, number of words and number of character format. If we only need any one of them , use option
-l for line numbers,
-w for words and
-c for characters.
wc -l file1.txt
Search and replace words
sed 's/Windows/Linux/' data.txt > newdata.txt
The above command find the first instance of
Windows in each line from
data.txt file and replace that text with
Linux and save the whole content to
Find the users who currently logged in
Displays the environment variables
Get the user name of the currently logged-in user
cal command will display current month calendar. But we can also specify the year.
Get system date & time
- Remove edit, view, trash and quick edit links within posts list of admin screen - WordPress
- PHP Errors not displaying or not logging - LAMP server - Solved
- Display all hooks sequentialy that run on a page - WordPress
- Get downloadable files of a downloadable product - WooCoomerce
- Add actions based on WooCoomerce order status
Your Questions / Comments
If you found this article interesting, found errors, or just want to discuss about them, please get in touch.