Linux basic commands:
Basic command: TTY terminal common Command Prompt command
System-Related commands: View system version View CPU view memory Information shutdown operation (init 0) Restart operation (Init 6)
TTY Terminal:
In the Linux default login mode, there are two main types, one is only the plain text interface of the login environment, the other is the graphical desktop login environment
Linux By default provides six virtual terminal to let the user log in, the system will f1~f6 command as TTY1-TTY6, using CTRL+ALT+FN key combination can switch from the graphical interface to the command line interface of the nth virtual terminal. (CentOS6)
In the CentOS7 system, FN represents F2~f6, and F1 is a graphical interface.
Press ALT+FN to convert between virtual terminals.
Common commands:
There are three ways to strike a command:
Open your own terminal, similar to CMD under Windows
Can enter the character interface
Remote connection
Hostname: Can view the full name of the current host, but also can modify the current host name, such as "hostname AAA", indicating that the modified host name is AAA (temporary modification, after exiting the re-login expired) (logout, exit after logging back)
Permanent modifications are made with the following command:
Vi/etc/sysconfig/network (permanently modify host name) CENTOS6 version
Vi/etc/hostname (permanently modify host name) Centos7 version
Press I enter the input mode, after modifying the hostname, press ESC to exit the input mode, and then press "shift+:" and then enter Wq, carriage return (cat/etc/hostname view)
PWD Displays the location of the working directory where the user is currently located
CD used to switch working directory (folder)
Absolute path: This method takes root directory '/' as the starting point
such as '/var/log ' denotes the log directory in the Var subdirectory under the root directory; To make it clear that log is a directory (not a file), you can add a directory delimiter at the end
As indicated as "/var/log/"
Cd/var/log; cd/var/log/
Relative path: This method generally takes the current working directory as the starting point, does not use the "/" symbol at the beginning, the relative path mainly includes the following several forms;
A. Use the directory name directly to represent the location of subdirectories in the current working directory; For example, the current directory is/VAR, execute CD log into the log subdirectory;
b, use two dots "..." Begins with the first level of the current directory (parent directory) as the starting point, for example, the current directory is/var/log, execute CD: Return to the/var directory;
c, use a dot number "." Start with a clear indication of the current working directory as the starting point, for example, the current directory is/var/log, "./messages" can represent the messages file in the current directory, which is often used when executing scripts later
In addition
CD ~ or CD back to the original home directory
CD-Switch back to the directory where you last executed the CD command
Cd.. Return to previous level directory
./Current Directory
.. /path to the parent directory
~ (Back to/root directory/home directory)
The LS command is primarily used to display content in a directory, including information about the properties of subdirectories and files, etc.
Prompt information:
What the prompt contains: Current user name/hostname/directory name/prompt
#: Super Administrator status
$: Normal user identity
System-related commands:
The main view of the Linux host system information.
1. View the system version
Lsb_release-a viewing the system version of the current operating system (CentOS 7 requires installation of the Redhat-lsb-core package)
View release: Cat/etc/redhat-release CENTOS7 View release version
2. View operating system: uname
3. View Kernel version: Uname-r
4. View IP Address: ifconfig
5. See CPU information: Cat/proc/cpuinfo
6. View memory Information: Cat/proc/meminfo
8. View hard disk information: Df-h
9, shutdown operation
Shutdown operation: Shutdown-h now
Poweroff (forced shutdown before 5.0)
Init 0
Delayed shutdown: shutdown-h + minutes "prompt content"
Example: Shutdown-h 5 "Guanji"
Cancel: Ctrl + C
Restart Operation:
Shutdown-r now
Reboot
Init 6
Delayed restart: shutdown-r + min
To cancel a deferred operation: ctrl+c;shutdown-c
Exit current command operating environment: exit
Experience Basic Linux Operations