Ls-al
List all files and subdirectories in the current directory
When a user logs on to Linux, the/etc/passwd file determines which shell to use, and the shell that the user uses is listed at the end of each line (/bin/bash)
Ls-f the file listed, the directory name followed by a symbol, columns such as the executable file plus "*" directory is added "/"
Nothing behind the CD will go back to the user's own home directory. If it's root, it's back to/root. This function is the same as cd~.
mkdir and RmDir mkdir is a new directory under the current directory, RmDir is used to delete the established directory
CP This command is equivalent to the copy command under DOS
Copy-r source file Destination file (target) parameter R refers to a subdirectory in a homologous file.
RM command is used to delete files, RM commands commonly used parameters are three:-i,-r,-f
The Rm-i test system asks us if we want to delete the test file, y/n to confirm whether to delete the test file
Rm-i directory names can be removed with subdirectories below the directory, which is more powerful than the rmdir mentioned above
Rm-f file name
This action can forcibly delete files without confirmation
So here to realize the seriousness of RM-RF, do not use it easily
MV The function of this command is to move the directory file, the extension function is to the directory file re-command
MV 1.tar 1.txt renamed 1.tar in/home directory to 1.txt
Cat This command is a very important command in Linux, his function is to display or connect the general ASCII text file
Cat file1 file2>file3 The command is to combine the contents of File1,file2 in a redirect to a file3 file
More is the instructions to display a generic text file, if a text file is too long for more than one screen, then cat view is not ideal, you can try more
PWD The function of this command is to display the user's current working path, directly enter the PWD to
User and User group commands
Useradd + username Create a new user account,
Useradd Tiantian System will create a new user Tiantian, the user's home directory is/home/tiantian
Useradd User name-G Group name-G group name-D Home directory name-p password
which
-g Specifies the user's first group
-g Specifies the user's secondary group
-d Specifies the user's home directory
-P Specify the password for the user
If you enter the following command:
Useradd oracle-g oinstall-g dba-d/home/oracle-p ora123
The system will create a user oracle,oracle user's first group is Oinstall, the minor group is Dba,home directory is/home/oracle, the password is ora123
userdel+ User name Delete an existing account
Groupadd + Group name create a new user group
groupdel+ Group name to delete a user group name that already exists
passwd command to change your password
passwd: After you enter this command, you will be prompted to enter the password and password confirmation once, you can complete the user password modification
In addition, Superuser can modify other user's password
passwd + user Name
Chmod is used to change the access rights of a file or directory. There are two ways to do this: one is a text setting that contains letters and operator expressions, and the other is a digital setting method that contains numbers.
1: Action object who can be any of the following letters or a combination of them
U means the user is the owner of the file or directory
G indicates that the same group user is all users with the same group ID as the file owner
O indicates other (others) users
A: Indicates all users (all) It is the system default value
2: The operation symbol can be:
+: Add a permission
-: Cancel a permission
=: gives the given permission and cancels all other permissions
3:mode represents permissions, and the commonly used parameters are:
R: Readable
W: Writable
X: Executable
The file text, the permission is set to: The file belongs to the master readable, writable, executable, and the file belongs to the same group of user-readable, other users are unreadable,
Chown: Used to change the owner or group of a file or directory, such as the root user to copy one of their own files to the user Oracle, in order for the user Oracle to access this file, the root user should be the owner of this file to Oracle
chown[User: Group] File
Example: Change the owner and the group of the test file to Oracle and DBA respectively
Chown ORACLE:DBA Text
Create a new directory with root and create a new file under it, authorizing both of the following:
chmod o=r XXX
Then switch to the normal user, try to open the directory and discover the failure
When the following authorization is found, the directory and file can be opened but cannot be modified:
chmod o+x XXX
Note that the R permission is readable for the file, but for the directory, you must have X permissions to enter the directory.
PS: View Process
-F: Full format display
-e: Show All Processes
-L: Long format display
The items displayed are UID (with ID of the execution process), PID (process), PPID (parent process ID), TTY (terminal name) stime (process start time), and the time (Process execution times) CMD (command line input for the process)
However, it is common to use PS-EF output more than Ps-ef | grep Oracle
The basic function of top and PS commands is the same, showing the current process and other conditions of the system. But top is a dynamic display process, q exits
Kill + Process Number End process
KILL-9 1234 terminates a process with PID process number 1234 (-9 means force stop)
Cron is used to accomplish timed tasks
A user with user name is the crontab file that corresponds to it should be/var/spool/cron/user. In other words, the crontab file with the user command is stored under the/var/spool/cron directory. The cron command also searches for/etc/crontab files, which are written in different formats. After Cron starts it will first check if a user has set up the crontab file
If not, go to hibernation and release the system resources. It wakes up every minute. See if there are currently any commands that need to be run
can use
crontab-l command to view cron tasks that are currently in existence
Crontab-r Delete the current user's cron process
CRONTAB-E Adding a scheduled task
Time-sharing Week
DF-K will show disk space usage for each partition.
Reboot System restart command
Shutdown shutdown system {option} {time} {warning message}
-K: does not really shut down and just sends a warning message to all users
-R: Restart immediately after shutdown
-H does not restart after shutting down the machine
-F Fast shutdown reboot Skip Fsck
-N Fast shutdown without init program
-C cancels an already running shutdown
Shutdown-r +10 system shuts down in 10 minutes and restarts immediately
Shutdown-h now system shuts down immediately and does not restart
Noun Introduction:
Console: (console), which is our common human-computer interface using a string interface, such as DOS. The console command we're talking about is a command that can be operated by the operating system via the character interface, such as a DOS command, which is a console command.
Linux is a multi-user operating system, which means that it can accept multiple user logins at the same time. Linux also allows one user to log on multiple times, because Linux and UNIX provide access to the Virtual console, allowing users to log in from the console multiple times at the same time
Summary of common commands for Linux (System centos6.5)