This article describes important Linux commands that you must know as a system or database administrator.
Here is the full article link: https://www.support.dbagenesis.com/post/important-linux-commands
2. Check CPU Cores in
Linux
Use one of the below commands to find number of CPUs
in Linux including cores
3.
4. Linux Create Directory
To create a single directory in Linux
To create multiple directory in Linux
To create a directory by setting permission
5. Linux Touch Command
One of the easiest ways to create a new and empty file is the
touch command. Use below command to create an empty file
Create multiple empty files
6. Linux Files and
Directory Permissions
There are three main permissions that you assign to a file or
directory
Read - 4
Write - 2
Execute - 1
7. To give full permissions to owner (read, write and execute),
give read and execute permission to other group members
and no permissions to all other users
And, there are three main levels of permissions
Owner of the file
Other members of the group which owner belongs to
All other users on the server
8. To give full permissions on /u01 and also to all the contents inside
the folder
Here
7 = Read(4) + Write(2) + Execute(1)
5 = Read(4) + Execute(1)
0 = No permissions
9. Linux WC Command
The wc command allows you to count the number of lines,
characters, and words in a text. To count the number of lines in a file
10. To count the number of characters in a file
To count the number of words in a file
12. To sort a file and remove the duplicate values
To sort a file in reverse order
13. Linux GREP Command
GREP command is used to search anytime inside a file or output.
Linux grep is different from Linux find command. Linux find command
is used for searching files and directories. Linux grep is powerful and
can be used for searching a pattern inside a file.
14. To print each line containing the word oracle. The
command is case sensitive
If you want to ignore the case, use -i
To search a specific phrase inside a file
15. To count total number of lines that contain a specific word
To print line number along the exact line that contains the word oracle
To get the name of the files that contain a specific string (oracle) inside
16. To match the lines which start with the given string or pattern
To match the lines which end with the given string or pattern
17. Linux Find Command
To find files older than 35 days in a specific directory path and save
the ouput in backupfiles.log. Here the directory we are searching is
/backup/logs and -mtime specifies the modified time of a file. We
are saving the list of all the files which are older than 35 days in
backupfiles.log
18. To print files older than 7 days on screen and do not want to save
it into a file, use below command
To find all the files under current location (as we have specified .
dot), search file name starting with arch and ending with log.
check file create time with -ctime older than 28 days and then
remove those files using rm -f
19. Force User to Change
Password
To force user to change password on next login, first of all the
password must have expired
20. Run below command which will force user to change password
on next login
To check the status of a user's password