This is my university notes Mu class, specific video click here
Item 2 preliminary examination Shell
2.1 Shell Overview
1.Shell is between the user and the operating system kernel ( Kernel an interface) between; Linux command line is
2.Shell
- Bourne Shell(/bin/sh,/bin/bash)
- C Shell(/bin/csh,/bin/tcsh)
- Korn Shell
3.Bash: including early Bourne Shell and Korn Shell all functions, and some of the features added to the C Shell ( which is the default operating system, various Linux Shell )
4. The method of using the Shell
- graphic interface
- Terminal window
- Virtual Terminal (opening: Ctrl + Alt + F2 or Ctrl + Alt + F6, Returns: Ctrl + Alt + F1)
- Text interface
5. The front terminal content - [SJH the root-COM @ ~] #
- Currently logged on user name is root
- Host named sjh-com
- The current directory is ~ ( home directory )
- # Is the prompt ( super user, if it is $ prompt, compared with the average user )
6. The handover command account: su
Syntax: su [-] [username]
SU is equivalent to the root SU
SU SJH
extension: - action option
2.2 file and directory management command
Command List
- Copying files: cp
- Format: cp [-fir] source file destination
- -f represents a direct coverage
- -i represents the views of users (Y / n-)
CP / etc / password / tmp
CP -R & lt / etc / yum / tmp
- Move files: mv
- Format: mv [-fi] source file destination
mv / tmp / yum / etc
mv * .c / Home / SJH
mv test.txt test2.txt
- Format: mv [-fi] source file destination
- Delete files or directories: rm
- Command Format: rm [-f -i -r] file or directory name
RM / tmp / *
RM -rf / tmp / *
- Command Format: rm [-f -i -r] file or directory name
- Lists files and directories: ls
- Format: ls [-lida] [filename or directory name]
LS
LS the -l
LS -a / root
LS -dil / root
- Format: ls [-lida] [filename or directory name]
- Create a directory: mkdir
- Syntax: mkdir [-p] directory name
mkdir ~ / Tools
mkdir -p zzti / CS / WL15
- Syntax: mkdir [-p] directory name
- To delete a directory: rmdir
- Format: rmdir [-p] directory name
rmdir -p zzti / cs / wl15
- Format: rmdir [-p] directory name
- View the current working directory: pwd
- Change directory: cd
- Syntax: cd [pathname]
CD
CD ~
CD ..
CD -
CD /
CD / Boot / GRUB
- Syntax: cd [pathname]
- View files and directories: find, locate
- View file types: file
- Format: file filename
File / bin / LS
File / etc / passwd
- Format: file filename
2.3 Linux operating level
1. Run level ( runlevel ): operating system currently running functional level, defined in the / etc / inittab file
seven kinds of run level 2.Linux
0 halt shutdown, shutdown state represents the system
1 Single user mode single-user mode, supports only the root account
2 Multiuser, without NFS network file system does not support multi-user mode
3 Full Multiuser mode complete multi-user mode
4 unused system is not used, as reserved
5 X11 graphical multi-user mode
6 reboot to restart
3. The different operating levels may be switched with each other, and essentially no difference in the level of functional
Complement: If you lose the password for the root account, allowing the machine to boot into single-user mode, and then use the passwd command to reset the root password
4. Run level Principle
There are many /ect/rc.d/init.d in the directory server scripts, commonly referred to as Service ( Service )
has named seven rcN.d in /etc/rc.d ( N the range of 0 to 6 ) directories, 7 run level corresponding to the system
under rcN.d directory are some of the symbolic link files that point to service script files in the init.d directory, file naming these links to K + nn + service name or S + nn + service name, where nn is a two-digit number
will enter the corresponding rcN.d directory system according to the specified run level and follow the links to files in order to retrieve the file name directory: for with K ( Kill beginning of the file), the system the termination of the corresponding service; respect to S ( the start file) at the beginning, the system will start the corresponding service
The run level related operations
- View run level: runlevel
- Other operating level: the init N ( N is a value of 0123456 )
Set to run in command-level 6.CentOS7.3
- Checking runlevels: systemctl get-default
- Modified to run level 3: systemctl set-default multi-user.target
- Modified to run level 5: systemctl set-default graphical.target
2.4 Linux under common shortcuts
Details are as follows
command | Features |
---|---|
Tab | Command Completion |
File name or path completion | |
Continuously press the Tab key twice, the display begins with the characters you have entered all the commands, file name or path | |
Ctrl+D | Exit terminal |
As in edit mode, then exit edit mode | |
Delete from the cursor to the right | |
Ctrl+C | The end of the currently executing command |
Cancel edit the current command line | |
Ctrl+L | Terminal cleared |
Ctrl+Z | The running program to the background |
Ctrl+R | Search-history |
Ctrl+A | Move the cursor to the first row of the line |
Ctrl+E | Move the cursor to the end of the line where the line |
Ctrl+U | Entered an incorrect command, use the shortcut key will erase the entire contents from the current cursor position to the beginning of the line |
Ctrl+K | Entered an incorrect command, use the shortcut key will erase the entire contents from the current cursor position to the end of the line |
Ctrl+W | Erase the word before the cursor position; if the cursor on a word itself, it will erase all of the letters of the first word from the cursor position to the word |
Ctrl+Y | Paste using Ctrl + W, Ctrl + U and Ctrl + K shortcut erased text |
Unfinished, continued ~