The basic principles of Linux:
1. Composed of a single-purpose applet: Combining applets to accomplish complex tasks
2. Everything is a document
3. Avoid capturing user interfaces as much as possible
4. Save the configuration file in plain text format
GUI interface:
dblclick
CLI interface:
Command prompt, prompt,bash(shell)
#:root
$: Ordinary users
Command: The command is sent to the kernel by the shell, and the kernel determines whether it has permission to execute and where to start execution.
[root@Smoke ~]# LSS (error message returned through shell)
-bash: lss: command not found
Command format:
Command Option Parameters
Options: Modify how commands are executed. Options can have multiple
Short Options: One horizontal bar'-'leads with one character, -character, multiple options can be combined with each other.
For example: -a-b = -a B
Long option: Two horizontal lines'--'lead with one word, --word, long option usually cannot be combined and must be written separately.
Parameters: The object to which the command operates, which can be separated from each other by spaces with multiple parameters.
[root@Smoke ~]# Ls (without options) anaconda-ks.cfg pam_mysql-0.7-0.12.rc1.el6.x86_64.rpm cacti-0.8.8b.tar.gz Pictures [root@Smoke ~]# Ls-l (-l option details) //Total dosage 310680 -rw-------. 1 root root 1394 4 1408 January:38 anaconda-ks.cfg -rw-r--r-- 1 root root 2272130 5 January 1420:14 cacti-0.8.8b.tar.gz drwxr-xr-x. 2 root root 4096 4 January 1521:27 Desktop drwxr-xr-x. 2 root root 4096 4 January 1521:27 Documents [root@Smoke ~]# Ls-a (-a view all) . .gnote Pictures .. .gnupg Public .abrt .gstreamer-0.10 .pulse anaconda-ks.cfg .gtk-bookmarks .pulse-cookie [root@Smoke ~]# Ls-a-l (multiple options, -a shows a l l, -l details) //Total dosage 310848 dr-xr-x---. 31 root root 4096 5 Month 31 23:30 . dr-xr-xr-x. 26 root root 4096 5 February 21 20:43 .. drwxr-xr-x. 3 root root 4096 4 January 1521:55 .abrt -rw-------. 1 root root 1394 4 1408 January:38 anaconda-ks.cfg [root@Smoke ~]# Ls-al (multiple options combined) //Total dosage 310848 dr-xr-x---. 31 root root 4096 5 Month 31 23:30 . dr-xr-xr-x. 26 root root 4096 5 February 21 20:43 .. drwxr-xr-x. 3 root root 4096 4 January 1521:55 .abrt -rw-------. 1 root root 1394 4 1408 January:38 anaconda-ks.cfg [root@Smoke ~]# Ls/etc/(command with parameters, display current directory without parameters) abrt enscript.cfg ld.so.cache pinforc [root@Smoke ~]# Ls/root/var (command with multiple parameters) /root: anaconda-ks.cfg pam_mysql-0.7-0.12.rc1.el6.x86_64.rpm cacti-0.8.8b.tar.gz Pictures /var: account crash db ftp
How to implement user login and switch:
Use credentials: Verify user identity.
Linux is case-sensitive.
Smoke login:root (login prompt when not logged in)
Password:
[root@Smoke ~]# (command prompt)
Virtual terminal:
CTRL+ALT+F1-F6: Default 6 terminals.
[root@Smoke ~]# startx & (starts the GUI, &indicates the program is running in the background)
Graphic terminal: CTRL+ALT+F7
Analog terminal: To execute a command in the graphical interface, click the right mouse button and select Open Terminal to open a terminal.
Or open the analog terminal by selecting "Applications" --> "Accessonries" --> "Terminal" from the menu bar.
GUI type:
1. Gnome:C Development
2. Development of KDE:C++.
3. Xface: Introduction to lightweight embedded desktop
CLI: Enables the user to enter a command and retrieve the results of the command back to a user interface or human-computer interaction interface on the current screen.
sh1, bash: the most widely used and powerful open source shell
2,csh
3,zsh
4,ksh
5,tcsh
Whenever a shell-related program is closed, it will also be closed.
Switch users:
Suppose: There are three users root, student, and visor to complete user switching after installing the system.
su:Switch User switches users.
# su [-l] username: brackets [] indicate that can be omitted,
Another philosophical thought on Linux can be abbreviated but never completely written.
[root@Smoke ~]# Su student (switch to student user, semi-switch, with root) [student@Smoke root]$ exit(Return to original position) exit [root@Smoke ~]# Su-l student (switch to student user, -l switch completely, no root) [student@Smoke ~]$ [student@Smoke ~]$ exit(Exit User) logout
Change password:
# passwd: Used to modify the current user's password. Administrators can change other passwords at will. For ordinary users, the default policy must comply with password complexity rules.
Password complexity rules:
1. Use at least three of the four types of characters;
2. Long enough to be greater than 7 bits;
3. Use random strings;
4. Define replacement;
5. The cycle should be large enough;
[root@Smoke ~]# Passwd (change current user password) Changing password for user root. New password: BAD PASSWORD: it is based on a dictionary word Retype new password: passwd: all authentication tokens updated successfully.
Shelll:
GUI:Graphic User Interface GUI
Windows:windows: Windows desktops were built directly into the kernel before 2008, and winodws could not be used without a desktop.
X-Window:X refers to its protocol, graphics display protocol, super meaning, the desktop of Linux is just a peripheral software, X-Windows is C/S architecture, the current host is installed in the system, another monitor to use as the display graphics interface is also completely possible, the host and display are completely separable, but notThe display side is called Server and the request side is called Client.
1,Gnome
2,KDE
3,Xface
CLI:Command Line Interface command line interface
1,sh
2,bash
3,csh
4,ksh
5,zsh
6,tcsh
Operating system composition:
At the bottom is hardware, hardware resources are unique. On a single CPU system platform, in order to run multiple programs on the same computer at the same time, there is a general management software called Kernel (kernel), the kernel is only a platform, it does not provide specific tasks, only abstracts the computing power provided by hardware.It comes out and is available to other software at the upper level, but it is provided in a way called System Call (System Call). System calls are too low-level, which makes it very difficult for programmers to develop programs. Therefore, there are libraries, which encapsulate the functions of one or more system calls into a more advanced calling interface. Libraries areAn executable program, but it cannot be executed independently, and must be called before it can be executed. On top of the library are various applications, which vary according to their needs, such as shell s with unique user interfaces, web servers, or IDEs.
IDE: The development environment used by programmers when developing.
There are many windows directories in the Winodws system.dll file is the dynamic connection library file of windows.
DLL:Dynamic Link Library Dynamic Link Library.
Library files on Linux systems end with.so called shared objects.
so:shared object shared object.
dso:Dynamic shared object dynamically shares objects.
Make an operating system:
You need to provide a kernel, provide some libraries, or provide running software, provide those libraries as well as a shell, depending on which libraries the software depends on.
A linux can be made into a 2-3M look, with a kernel of 1M, a library of 1M, and a shell of 1M.
login:(authenticate user)
User name: User ID (user identifier)
The fastest computer recognizes is not a character but a number.
Each user name has an ID, the user name is public, and the user name cannot be used as an authentication identifier that restricts whether or not the user can access the resource.
Authentication:
The process of authentication is the process of identifying a user or a person as the person it claims to be.
Certification does not represent all of them, and authorization to access resources is required after the certification is complete.
Authorization:
Audition: Log
Smoke login:root
Password:
[root@Smoke ~]#
promprt: Command prompt.
Command: It can be either a binary command or a script.
magic number: magic number, identifying the binary execution format.
The magic number of programs executed on winodws is different from the magic number of programs executed on linux, and they understand different binary formats, so even if the libraries of both are identical, programs compiled on Linux may not run on windows.
shebang
#!/bin/bash (specify magic number)
When a program is started, the program's execution entry is submitted to the kernel. Only the kernel can manage the process. When we type a command at the command prompt and hit the car back, the program will be submitted to the kernel by bash. The kernel then goes to find the magic number of execution of the program.See if it's an executable format, and if it's an executable format understood by the current kernel, and if it's executed, it refuses to run, depending on permissions and various peripheral mechanisms.
Format of command:
# command options... arguments...
Options: Modify command execution properties.
Short option: can merge
Long options:
Parameters: Specifies the object to which the command will operate, with multiple parameters separated by spaces.
Some options in a command can have parameters, which are different from the parameters of a command.
ls:list list list list, list; you can list all subdirectories or files under a specified directory.
Folder: Misleading directory by winodws system.
Directory: A directory is also a file. A directory is not a folder. It is just a path mapping.
Path: The location from the beginning of an instruction to the destination through which the path is intended to implement a hierarchical file management mechanism.
file system: The mechanism by which file systems hierarchically manage files.
Absolute path: Find the corresponding file from the root.
Relative path: The path relative to the current location.
Working directory: The directory where the working directory will be located after it logs in to the system.
Current directory: The current directory's current location.
FHS: File system hierarchy standard that states that those directories must exist and that those directories must contain those files.
[root@Smoke ~]# Ls (lists current directory files and subdirectories) anaconda-ks.cfg nagios-plugins-2.0.1 rrdtool-1.3.8-7.el6.x86_64.rpm cacti-0.8.8b.tar.gz
pwd:Printing Working directory displays the current directory.
/: The root directory indicates that directory nodes are used/separated.
Blue: Directory.
Green: Execution rights.
Purple: Socket file
There are six common colors.
[root@Smoke ~]# PWD (show current directory) /root [root@Smoke ~]# Ls/root/(show/root directory files and subdirectories) anaconda-ks.cfg nagios-plugins-2.0.1 rrdtool-1.3.8-7.el6.x86_64.rpm cacti-0.8.8b.tar.gz
ls:list list list list, list; you can list all subdirectories or files under a specified directory.
-l: Long format, showing complete information, showing many attributes of the file.
File Full Information Interpretation:
----------: 10 bits, the leftmost one is the file type, the last 9 bits represent permissions, each group of 3 bits contains: RWX (read and write execution), if there is no corresponding permission bar-representation.
File type:
-: normal file (f)
d:Catalog file
b: Block device file (block)
c: Character device file
l: Symbolic link file, also known as soft link.
p:named pipe file
s: Socket file
rwx: write, write execution.
r--: Readable, not written, not executable.
Number of hard file connections:
The number after the permission indicates the number of times the file has been hard-linked.
Owner of file
Group of files
File size: Default unit bytes.
Timstamp: This shows the last modified time. Every file has three timestamps, including the last accessed time, the last modified time, and the last changed time.
access: access Read
Modify: modify changes the contents of the file.
change: change changes the properties or metadata of the file.
A file has two kinds of data, one is the data of the file itself, the other is the attribute data of the file, which is also called metadata.
Metadata: metadata
Filename:
-h: do unit conversion.
-a:all shows all files, and linux starts with.to indicate hidden files.
.: Blue, which represents the directory, represents the current directory
..: Blue, which represents the directory, represents the parent directory of the current directory.
-A: Displays all files, but does not include when.front directory and..Superior directory.
-d: Displays the properties of the directory itself.
Computer recognizes users by numbers, and so does file names, where each file has a unique numeric identifier, called the inode of the file (the index node of the file)
inode:index nodeļ¼
-i: Displays the file index node number.
Use ls to view files and subdirectories in a directory whose names are sorted alphabetically and in ascending order.
-r: Displays file sorting in reverse order.
-R: Recursive shows that the comparison consumes resources.
[root@Smoke ~]# Ls-l (displays the complete information of the current directory file subdirectory, -l displays the complete information) total 310680 -rw-------. 1 root root 1394 Apr 14 08:38 anaconda-ks.cfg(Normal File) -rw-r--r-- 1 root root 2272130 May 14 20:14 cacti-0.8.8b.tar.gz drwxr-xr-x. 2 root root 4096 Apr 15 21:27 Desktop(Catalog Files) drwxr-xr-x. 2 root root 4096 Apr 15 21:27 Documents [root@Smoke ~]# ls(list list list, list; can list all subdirectories or files under a specified directory) anaconda-ks.cfg nagios-plugins-2.0.1 rrdtool-1.3.8-7.el6.x86_64.rpm cacti-0.8.8b.tar.gz [root@Smoke ~]# Ls-l/dev/(View full file and subdirectory information under / dev directory, -l long format, show full information, show many properties of file) total 0 crw-rw---- 1 root video 10, 175 May 21 20:43 agpgart(Character Device Files) crw-rw---- 1 root root 10, 56 May 21 20:44 autofs lrwxrwxrwx 1 root root 3 May 21 20:43 cdrom -> sr0(Symbolic Link File) lrwxrwxrwx 1 root root 3 May 21 20:43 cdrw -> sr0 [root@Smoke ~]# Ifconfig (see host address) eth0 Link encap:Ethernet HWaddr 00:50:56:3A:91:69 inet addr:172.16.100.1 Bcast:172.16.100.255 Mask:255.255.255.0 inet6 addr: fe80::250:56ff:fe3a:9169/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:40 errors:0 dropped:0 overruns:0 frame:0 TX packets:47 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:4557 (4.4 KiB) TX bytes:5770 (5.6 KiB) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:868 errors:0 dropped:0 overruns:0 frame:0 TX packets:868 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:57236 (55.8 KiB) TX bytes:57236 (55.8 KiB)
Log in to the Linux system using Xshell 4:
Xshell:\> ping 172.16.100.1(Test whether ping through linux system) //Ping 172.16.100.1 with 32 bytes of data: //Reply from 172.16.100.1: Byte=32 Time <1ms TTL=64 //Reply from 172.16.100.1: Byte=32 Time <1ms TTL=64 172.16.100.1 Of Ping statistical information: //Packet: sent = 2, received = 2, lost = 0 (0% lost), //Estimated round-trip time in milliseconds: //Minimum = 0ms, Maximum = 0ms, Average = 0ms Xshell:\> ssh 172.16.100.1(Use ssh Connect linux Host) [root@Smoke ~]# Ls-l/tmp/(View full information of files and subdirectories under/tmp directory) total 44 -rw------- 1(Number of File Hard Connections) root(owner) root 18009 May 29 19:44 yum_save_tx-2014-05-29-19-44KIYaTb.yumtx(Read, write, execute) drwx------. 2 Smoke Smoke 4096 Apr 14 01:19 pulse-8G34pGhBrYlR drwxr-xr-x 2 root root 4096 May 29 19:39 puppet srwxr-xr-x 1 root root 0 May 18 02:43 mapping-root(s socket) [root@Smoke ~]# Ls-l-h (view the full information of the current directory file and subdirectories and do unit conversion, -l displays the full information, -h unit conversion) total 304M -rw-------. 1 root root 1.4K Apr 14 08:38 anaconda-ks.cfg -rw-r--r-- 1 root root 2.2M May 14 20:14 cacti-0.8.8b.tar.gz drwxr-xr-x. 2 root root 4.0K Apr 15 21:27 Desktop drwxr-xr-x. 2 root root 4.0K Apr 15 21:27 Documents [root@Smoke ~]# Ls-l h (view the full information of the current directory file and subdirectories and do unit conversion, -l displays the full information, -h unit conversion, combination options) total 304M -rw-------. 1 root root 1.4K Apr 14 08:38 anaconda-ks.cfg -rw-r--r-- 1 root root 2.2M May 14 20:14 cacti-0.8.8b.tar.gz drwxr-xr-x. 2 root root 4.0K Apr 15 21:27 Desktop drwxr-xr-x. 2 root root 4.0K Apr 15 21:27 Documents [root@Smoke ~]# Ls-a (shows files in the current directory and all files in subdirectories including hidden files, -a shows all on behalf of all) . .lftp .. .local [root@Smoke ~]# ls. (Displays current directory files and subdirectories) anaconda-ks.cfg pam_mysql-0.7-0.12.rc1.el6.x86_64.rpm cacti-0.8.8b.tar.gz Pictures [root@Smoke ~]# ls.. (Displays files and subdirectories of the previous directory) bin dev home lib64 media mnt opt root selinux srv tmp var boot etc lib lost+found misc net proc sbin shared sys usr [root@Smoke ~]# Ls-A (Option-A shows all files, except when. front directory and..Parent directory) .abrt .local anaconda-ks.cfg .mozilla [root@Smoke ~]# Ls-l d/root/(displays the full information properties of the directory itself, -l displays the full information, -d displays the directory itself) dr-xr-x---. 31 root root 4096 Jun 1 14:43 /root/ [root@Smoke ~]# Ls-i (shows index node numbers for files and subdirectories in the current directory, -i shows index node numbers) 793872 anaconda-ks.cfg 786737 pam_mysql-0.7-0.12.rc1.el6.x86_64.rpm 793444 cacti-0.8.8b.tar.gz 790976 Pictures [root@Smoke ~]# Ls-R (recursively displays files and subdirectories and subdirectory files in the current directory, -R recursively displays) .: anaconda-ks.cfg cacti-0.8.8b.tar.gz Desktop [root@Smoke ~]# Ls-r (displays subdirectories and files in reverse order under the current directory, -r displays in reverse order) vmware-tools-distrib nrpe-2.15.tar.gz Videos nrpe-2.15
cd:change directory toggles the current working directory.
cd: Return to the user's home directory without any parameters.
home directory, home directory
Each user's home is represented by a ~wavy line in bash.
cd ~: Go back to the user's own home directory.
cd ~USERNAME: Switch to the home directory of the specified user, and only administrators have permission to enter another home.
cd -: switch back and forth between the current directory and the previous directory.
[root@Smoke ~]# pwd (show current directory, in / root directory) /root [root@Smoke ~]# Cd/usr/(switch to/usr directory) [root@Smoke usr]# PWD (show current directory, in / usr directory) /usr [root@Smoke usr]# cd(cd does not switch to user home directory with any parameters) [root@Smoke ~]# [root@Smoke ~]# Cd/usr/(switch to/usr directory) [root@Smoke usr]# cd ~(cd plus parameters~wave back to user's home directory) [root@Smoke ~]# [root@Smoke ~]# cd ~student(cd plus parameter ~username, switch to the home directory of the responding user) [root@Smoke student]# PWD (show current directory, at / home/student) /home/student [root@Smoke student]# cd(cd does not switch to user home directory with any parameters) [root@Smoke ~]# cd -(cd plus parameters -, switch back and forth between the previous directory and the current directory) /home/student
Command type:
Built-in commands: shell built-in commands, internal, built-in commands; after we log in to the system, we default to a login prompt, indicating that we have started the shell, this shell must have some basic commands built in to complete some self-management.
External command: There is an executable file corresponding to the command name in a path of the file system
cd is a shell builtin: shell built-in, internal commands.
which: View the directory where the command file is located.
Type: Displays what type of command the specified command belongs to
[root@Smoke ~]# type cd cd is a shell builtin(shell Built-in, internal commands) [root@Smoke ~]# type ls ls is aliased to `ls --color=auto'(External Command) [root@Smoke ~]# type su su is /bin/su(External Command) [root@Smoke ~]# Which LS (see the directory where the command file is located) alias ls='ls --color=auto' /bin/ls
When we execute a command, we don't tell it what command to execute under that path, how it knows, how the system can find this command, reasonably we must give it a full path to any file we refer to, in order to make it easy for users to execute their commands at the command promptSo, it gives us a built-in mechanism that is implemented through a method called environment variables.
Variables:
Environment variable: Named memory space, divided a space in memory to give it a name, I can put data into the named memory space, the user defines the current user's workspace properties.
Variable assignment: The process of placing data whose name is only useful in the current program. Variables can be either applied for or released.
NAME=jerry:equal sign=means assignment.
The process of declaring variables: The program tells the operating system to give me a piece of memory, and I'll wait for the data to be placed and the process of applying for memory usage.
Stack: In programming, stacks are called heap s and stacks, which are used to store different types of data, such as variables and static variables, which are usually generated locally in the stack. Other users who request to save data are not required to request a space to save data. This is usually a stack, so they areThere are two different mechanisms for requesting memory space, and they are also different in address space.
Either shell has its own environment changes;
PATH: A stack of paths separated by colons, whose order is critical.
PATH=/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
When we execute a command it will find one of these specified paths in order until it is found for the first time. If both commands have the same command, such as ls, the path in which the two commands are located is the one in front of the PATH.
If you want to execute a lot of commands, but you need to find them once every time. Although the computer executes quickly, it is very slow to find them each time. There are thousands of commands on the system. If a command is executed for the first time, it must be searched in real time. If you find it, execute the same command the second time.No, there will be a cache, find a place in memory to cache the corresponding commands and directories, bash has a cache, in the cache recorded the path of all commands used before, and then use in the future will not search, but to find the cache first.
hash: View the command cache.
If there is a lot of caching, is it faster to find the cache than to find files? The cache holds a hash list, a hash is a key value, a built-value database, and the speed of finding content in the built-value library is O(1).
O(1): A measure of the speed at which a program executes. The rate at which we look for a piece of data from a list changes with the length of the list. O(1) indicates that no matter how long the queue is, the time I look for a piece of content is the same.
If we develop a program that is placed under a path and that path is no longer in the PATH=path, it cannot be executed if it is executed without a path, so our command must be PATH=command under the specified path, either give it a full path, or add the path to the PATH=path.Come.
[root@Smoke ~]# /bin/ls (full path executes LS command) anaconda-ks.cfg pam_mysql-0.7-0.12.rc1.el6.x86_64.rpm cacti-0.8.8b.tar.gz Pictures [root@Smoke ~]# Clear (clear screen) [root@Smoke ~]# clear [root@Smoke ~]# Printenv (display environment) HOSTNAME=Smoke(host name) TERM=xterm(Terminal type) SHELL=/bin/bash(Used shell type) HISTSIZE=1000 SSH_CLIENT=172.16.100.254 3901 22 QTDIR=/usr/lib64/qt-3.3 QTINC=/usr/lib64/qt-3.3/include SSH_TTY=/dev/pts/0 USER=root LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=01;05;37;41:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lz=01;31:*.xz=01;31:*.bz2=01;31:*.tbz=01;31:*.tbz2=01;31:*.bz=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=01;36:*.au=01;36:*.flac=01;36:*.mid=01;36:*.midi=01;36:*.mka=01;36:*.mp3=01;36:*.mpc=01;36:*.ogg=01;36:*.ra=01;36:*.wav=01;36:*.axa=01;36:*.oga=01;36:*.spx=01;36:*.xspf=01;36: MAIL=/var/spool/mail/root PATH=/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin PWD=/root LANG=en_US.UTF-8 SSH_ASKPASS=/usr/libexec/openssh/gnome-ssh-askpass HISTCONTROL=ignoredups SHLVL=1 HOME=/root LOGNAME=root QTLIB=/usr/lib64/qt-3.3/lib CVS_RSH=ssh SSH_CONNECTION=172.16.100.254 3901 172.16.100.1 22 LESSOPEN=|/usr/bin/lesspipe.sh %s DISPLAY=localhost:10.0 G_BROKEN_FILENAMES=1 _=/usr/bin/printenv OLDPWD=/home/student [root@Smoke ~]# Hash (cached command, hits represents how many hits have been hit and how many uses have been made.) hits command 4 /bin/touch 1 /usr/bin/printenv 13 /bin/ls 1 /usr/bin/clear
Show system time:
date: Time management, system time, not hardware time, with no option to view the current system time.
Linux:rtc Real Time Clock
ntp: Network Time Protocol.
linux will read the current time through rtc when it is on. Once it is read successfully, it will not be used anymore. In the future, our kernel itself will simulate the oscillator by software to maintain a clock inside the system. As long as our operating system is running, the kernel will automatically count under the CPU.When.
Hardware clock:
System clock:
clock: Hardware time, viewing the current hardware time without any parameters.
hwclock: Hardware time.View the current hardware time without any parameters.
Practice:
Use date to get the current year, month, day, hour, minute, second of the system separately
[root@Smoke ~]# Date (show system time) Sun Jun 1 20:07:38 CST 2014 [root@Smoke ~]# Clock (display hardware time) Sun 01 Jun 2014 08:19:14 PM CST -0.393199 seconds [root@Smoke ~]# Hwclock (display hardware time) Sun 01 Jun 2014 08:19:51 PM CST -0.535787 seconds
How to get help using commands:
Internal commands:
help COMMAND: Get help for internal commands.
External commands:
COMMAND--help: Get help from an external command.
Command manual:
man COMMAND: Both internal and external commands have a common way of using man help.
Note: Internal command man help, man is not this command, but the shell to which the command belongs. Internal commands generally do not use man help.
Man Chapter: Display (1) indicates Chapter 1. There are 8 common chapters for man.
1: User commands (/bin, /usr/bin, /usr/local/bin): Indicates a command that can be used by all users, including ordinary users.
2: System Calls
3: Library calls: Not all commands have library calls. Only libraries have library calls. If a command happens to have the same name as a library, they will both appear at the same time.
4: Special Files (Device Files): Device files are special files. They do not store anything in the real data area of the disk, they exist only as the access entrance to the device.
5: File format (syntax of configuration file): Many commands use options to define their execution characteristics. Some commands may have options that don't need to be specified by the user every time, or this command wants to start automatically when it starts. For very complex execution files, it usually has a text for the configuration fileFile, in which the program execution properties were previously specified by options, are saved, so this profile is similar to a variable, what = what defines the execution properties of the program, and explains the configuration file syntax corresponding to a command.
6: Game
7: Miscellaneous: Miscellaneous that is inconvenient to categorize.
8:Administration commands (/sbin, /usr/sbin, /usr/local/sbin): Commands that can only be used by administrators modify hardware and system-level parameters.
man NUMBERS COMMAND: If a command has more than one chapter, specify which chapter of the command to display. If the unspecified chapter shows a 1-7 past row, which one appears first.
whatis COMMAND: Displays summary information about the command and the chapters that appear in man's help.
Two files related to the user account number:
/etc/passwd
/etc/shadow
These two commands are named after us, so this file is formatted.
man's description of the command:
<>: Required
[]: Optional
...: can occur multiple times
|: Choose one more
{}: Grouping
MAN:
NAME: Brief description of command name and function
SYNOPSIS: Usage description, including available options
DESCRIPTION: A detailed description of the command's capabilities, which may include the meaning of each option
OPTIONS: Explain the meaning of each option
FILES: Configuration file associated with this command
BUGS:
EXAMPLES: Example usage
SEE ALSO: Additional reference
Flip screen:
Turn back one screen: SPACE
Turn a screen forward:b
Roll back: ENTER or j
Roll forward:k
Find:
/KEYWORD: Look back
n:Next
N: Previous
KEYWORD: Look forward
n:Next
N: Previous
q:Exit
Online Documentation:
info COMMAND: Get command information
PageUP: Up Translation
PageDown: Context Translation
Document: /usr/share/doc: Almost all command documents have
google search
apache, hadoop official manual
[root@Smoke ~]# Help CD (see help for internal command cd) cd: cd [-L|-P] [dir] Change the shell working directory. Options: -L force symbolic links to be followed -P use the physical directory structure without following symbolic links The default is to follow symbolic links, as if `-L' were specified. Exit Status: Returns 0 if the directory is changed; non-zero otherwise. [root@Smoke ~]# Ls--help (see help for using external commands ls) Usage: ls [OPTION]... [FILE]... List information about the FILEs (the current directory by default). Sort entries alphabetically if none of -cftuvSUX nor --sort. Mandatory arguments to long options are mandatory for short options too. -a, --all do not ignore entries starting with . -A, --almost-all do not list implied . and .. --author with -l, print the author of each file -b, --escape print octal escapes for nongraphic characters --block-size=SIZE use SIZE-byte blocks. See SIZE format below -B, --ignore-backups do not list implied entries ending with ~ -c with -lt: sort by, and show, ctime (time of last modification of file status information) with -l: show ctime and sort by name otherwise: sort by ctime -C list entries by columns --color[=WHEN] colorize the output. WHEN defaults to `always' or can be `never' or `auto'. More info below -d, --directory list directory entries instead of contents, and do not dereference symbolic links -D, --dired generate output designed for Emacs' dired mode -f do not sort, enable -aU, disable -ls --color -F, --classify append indicator (one of */=>@|) to entries --file-type likewise, except do not append `*' --format=WORD across -x, commas -m, horizontal -x, long -l, single-column -1, verbose -l, vertical -C --full-time like -l --time-style=full-iso -g like -l, but do not list owner --group-directories-first group directories before files. augment with a --sort option, but any use of --sort=none (-U) disables grouping -G, --no-group in a long listing, don't print group names -h, --human-readable with -l, print sizes in human readable format (e.g., 1K 234M 2G) --si likewise, but use powers of 1000 not 1024 -H, --dereference-command-line follow symbolic links listed on the command line --dereference-command-line-symlink-to-dir follow each command line symbolic link that points to a directory --hide=PATTERN do not list implied entries matching shell PATTERN (overridden by -a or -A) --indicator-style=WORD append indicator with style WORD to entry names: none (default), slash (-p), file-type (--file-type), classify (-F) -i, --inode print the index number of each file -I, --ignore=PATTERN do not list implied entries matching shell PATTERN -k like --block-size=1K -l use a long listing format -L, --dereference when showing file information for a symbolic link, show information for the file the link references rather than for the link itself -m fill width with a comma separated list of entries -n, --numeric-uid-gid like -l, but list numeric user and group IDs -N, --literal print raw entry names (don't treat e.g. control characters specially) -o like -l, but do not list group information -p, --indicator-style=slash append / indicator to directories -q, --hide-control-chars print ? instead of non graphic characters --show-control-chars show non graphic characters as-is (default unless program is `ls' and output is a terminal) -Q, --quote-name enclose entry names in double quotes --quoting-style=WORD use quoting style WORD for entry names: literal, locale, shell, shell-always, c, escape -r, --reverse reverse order while sorting -R, --recursive list subdirectories recursively -s, --size print the allocated size of each file, in blocks -S sort by file size --sort=WORD sort by WORD instead of name: none -U, extension -X, size -S, time -t, version -v --time=WORD with -l, show time as WORD instead of modification time: atime -u, access -u, use -u, ctime -c, or status -c; use specified time as sort key if --sort=time --time-style=STYLE with -l, show times using style STYLE: full-iso, long-iso, iso, locale, +FORMAT. FORMAT is interpreted like `date'; if FORMAT is FORMAT1<newline>FORMAT2, FORMAT1 applies to non-recent files and FORMAT2 to recent files; if STYLE is prefixed with `posix-', STYLE takes effect only outside the POSIX locale -t sort by modification time -T, --tabsize=COLS assume tab stops at each COLS instead of 8 -u with -lt: sort by, and show, access time with -l: show access time and sort by name otherwise: sort by access time -U do not sort; list entries in directory order -v natural sort of (version) numbers within text -w, --width=COLS assume screen width instead of current value -x list entries by lines instead of by columns -X sort alphabetically by entry extension -1 list one file per line SELinux options: --lcontext Display security context. Enable -l. Lines will probably be too wide for most displays. -Z, --context Display security context so it fits on most displays. Displays only mode, user, group, security context and file name. --scontext Display only security context and file name. --help display this help and exit --version output version information and exit SIZE may be (or may be an integer optionally followed by) one of following: KB 1000, K 1024, MB 1000*1000, M 1024*1024, and so on for G, T, P, E, Z, Y. Using color to distinguish file types is disabled both by default and with --color=never. With --color=auto, ls emits color codes only when standard output is connected to a terminal. The LS_COLORS environment variable can change the settings. Use the dircolors command to set it. Exit status: 0 if OK, 1 if minor problems (e.g., cannot access subdirectory), 2 if serious trouble (e.g., cannot access command-line argument). [root@Smoke ~]# Man ls (see the manual for ls commands) LS(1) User Commands LS(1) NAME(Command Name) ls - list directory contents(Brief functional description) SYNOPSIS(Use format description) ls [OPTION]... [FILE]... DESCRIPTION(Use description) List information about the FILEs (the current directory by default). Sort entries alphabetically if none of -cftuvSUX nor --sort. Mandatory arguments to long options are mandatory for short options too. -a, --all do not ignore entries starting with . -A, --almost-all do not list implied . and .. --author with -l, print the author of each file -b, --escape print octal escapes for nongraphic characters --block-size=SIZE use SIZE-byte blocks. See SIZE format below -B, --ignore-backups do not list implied entries ending with ~ -c with -lt: sort by, and show, ctime (time of last modification of file status information) with -l: show ctime and sort by name otherwise: sort by ctime -C list entries by columns --color[=WHEN] colorize the output. WHEN defaults to 'always' or can be 'never' or 'auto'. More info below -d, --directory list directory entries instead of contents, and do not dereference symbolic links -D, --dired generate output designed for Emacs' dired mode -f do not sort, enable -aU, disable -ls --color -F, --classify append indicator (one of */=>@|) to entries --file-type likewise, except do not append '*' --format=WORD across -x, commas -m, horizontal -x, long -l, single-column -1, verbose -l, ver- tical -C --full-time like -l --time-style=full-iso -g like -l, but do not list owner --group-directories-first group directories before files. augment with a --sort option, but any use of --sort=none (-U) disables grouping -G, --no-group in a long listing, don't print group names -h, --human-readable with -l, print sizes in human readable format (e.g., 1K 234M 2G) --si likewise, but use powers of 1000 not 1024 -H, --dereference-command-line follow symbolic links listed on the command line --dereference-command-line-symlink-to-dir follow each command line symbolic link that points to a directory --hide=PATTERN do not list implied entries matching shell PATTERN (overridden by -a or -A) --indicator-style=WORD append indicator with style WORD to entry names: none (default), slash (-p), file-type (--file-type), classify (-F) -i, --inode print the index number of each file -I, --ignore=PATTERN do not list implied entries matching shell PATTERN -k like --block-size=1K -l use a long listing format -L, --dereference when showing file information for a symbolic link, show information for the file the link references rather than for the link itself -m fill width with a comma separated list of entries -n, --numeric-uid-gid like -l, but list numeric user and group IDs -N, --literal print raw entry names (don't treat e.g. control characters specially) -o like -l, but do not list group information -p, --indicator-style=slash append / indicator to directories -q, --hide-control-chars print ? instead of non graphic characters --show-control-chars show non graphic characters as-is (default unless program is 'ls' and output is a terminal) -Q, --quote-name enclose entry names in double quotes --quoting-style=WORD use quoting style WORD for entry names: literal, locale, shell, shell-always, c, escape -r, --reverse reverse order while sorting -R, --recursive list subdirectories recursively -s, --size print the allocated size of each file, in blocks -S sort by file size --sort=WORD sort by WORD instead of name: none -U, extension -X, size -S, time -t, version -v --time=WORD with -l, show time as WORD instead of modification time: atime -u, access -u, use -u, ctime -c, or status -c; use specified time as sort key if --sort=time --time-style=STYLE with -l, show times using style STYLE: full-iso, long-iso, iso, locale, +FORMAT. FORMAT is interpreted like 'date'; if FORMAT is FORMAT1<newline>FORMAT2, FORMAT1 applies to non-recent files and FORMAT2 to recent files; if STYLE is prefixed with 'posix-', STYLE takes effect only outside the POSIX locale -t sort by modification time -T, --tabsize=COLS assume tab stops at each COLS instead of 8 -u with -lt: sort by, and show, access time with -l: show access time and sort by name otherwise: sort by access time -U do not sort; list entries in directory order -v natural sort of (version) numbers within text -w, --width=COLS assume screen width instead of current value -x list entries by lines instead of by columns -X sort alphabetically by entry extension -1 list one file per line SELinux options: --lcontext Display security context. Enable -l. Lines will probably be too wide for most displays. -Z, --context Display security context so it fits on most displays. Displays only mode, user, group, security context and file name. --scontext Display only security context and file name. --help display this help and exit --version output version information and exit SIZE may be (or may be an integer optionally followed by) one of following: KB 1000, K 1024, MB 1000*1000, M 1024*1024, and so on for G, T, P, E, Z, Y. Using color to distinguish file types is disabled both by default and with --color=never. With --color=auto, ls emits color codes only when standard output is connected to a terminal. The LS_COLORS environment variable can change the settings. Use the dircolors command to set it. Exit status: 0 if OK, 1 if minor problems (e.g., cannot access subdirectory), 2 if serious trouble (e.g., cannot access command-line argument). AUTHOR(author) Written by Richard M. Stallman and David MacKenzie. REPORTING BUGS(If a command is found to have BUG To whom will the message be sent) Report ls bugs to bug-coreutils@gnu.org GNU coreutils home page: < http://www.gnu.org/software/coreutils/ > General help using GNU software: < http://www.gnu.org/gethelp/ > Report ls translation bugs to < http://translationproject.org/team/ > COPYRIGHT(copyright) Copyright 2010 Free Software Foundation(Free Software Foundation), Inc. License GPLv3+: GNU GPL version 3 or later < http://gnu.org/licenses/gpl.html >. This is free software: you are free to change and redistribute it. There is NO WAR- RANTY, to the extent permitted by law. SEE ALSO(See if you want further information) The full documentation for ls is maintained as a Texinfo manual. If the info and ls programs are properly installed at your site, the command info coreutils 'ls invocation' should give you access to the complete manual. GNU coreutils 8.4 March 2014 LS(1) [root@Smoke ~]# Man CD (internal command man help, man is not this command, but the shell to which the command belongs) BASH_BUILTINS(1) BASH_BUILTINS(1) NAME bash, :, ., [, alias, bg, bind, break, builtin, caller, cd, command, compgen, complete, compopt, continue, declare, dirs, disown, echo, enable, eval, exec, exit, export, false, fc, fg, getopts, hash, help, history, jobs, kill, let, local, logout, mapfile, popd, printf, pushd, pwd, read, readonly, return, set, shift, shopt, source, suspend, test, times, trap, true, type, typeset, ulimit, umask, unalias, unset, wait - bash built-in commands, see bash(1) [root@Smoke ~]# Man 2 read (see chapter read 2 System calls) READ(2) Linux Programmer's Manual(linux Developer Manual) READ(2) NAME read - read from a file descriptor SYNOPSIS #Include <unistd.h> (this is a system call) ssize_t read(int fd, void *buf, size_t count); DESCRIPTION read() attempts to read up to count bytes from file descriptor fd into the buffer start- ing at buf. If count is zero, read() returns zero and has no other results. If count is greater than SSIZE_MAX, the result is unspecified. [root@Smoke ~]# export LANG="en" (modify language encoding to english) [root@Smoke ~]# Man mount (see mount's man help in chapter 8) MOUNT(8) Linux Programmer's Manual MOUNT(8) NAME mount - mount a filesystem SYNOPSIS mount [-lhV] mount -a [-fFnrsvw] [-t vfstype] [-O optlist] mount [-fnrsvw] [-o option[,option]...] device|dir mount [-fnrsvw] [-t vfstype] [-o options] device dir [root@Smoke ~]# Whatis read (see chapter several of the read com man dman help) read (1p) - read a line from standard input read (2) - read from a file descriptor read (3p) - read from a file read [builtins] (1) - bash built-in commands, see bash(1) [root@Smoke ~]# Man 4 TTY (see chapter IV man help section special file) TTY(4) Linux Programmer's Manual TTY(4) NAME tty - controlling terminal(Used to control terminals) DESCRIPTION The file /dev/tty(Corresponding Device Files) is a character(Character file) file with major number 5(Primary Number) and minor number 0(Secondary Number), usually of mode 0666 and owner.group root.tty. It is a synonym for the controlling terminal of a process, if any. In addition to the ioctl(2) requests supported by the device that tty refers to, the ioctl(2) request TIOCNOTTY is supported. [root@Smoke ~]# Cat/etc/passwd (view the contents of the / etc/passwd file, which is separated by a formatted pass colon: root:x:0:0:root:/root:/bin/bash bin:x:1:1:bin:/bin:/sbin/nologin daemon:x:2:2:daemon:/sbin:/sbin/nologin adm:x:3:4:adm:/var/adm:/sbin/nologin lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin sync:x:5:0:sync:/sbin:/bin/sync shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown halt:x:7:0:halt:/sbin:/sbin/halt mail:x:8:12:mail:/var/spool/mail:/sbin/nologin uucp:x:10:14:uucp:/var/spool/uucp:/sbin/nologin operator:x:11:0:operator:/root:/sbin/nologin [root@Smoke ~]# Man passwd (show help for command) PASSWD(1) User utilities PASSWD(1) NAME passwd - update user's authentication tokens SYNOPSIS passwd [-k] [-l] [-u [-f]] [-d] [-e] [-n mindays] [-x maxdays] [-w warndays] [-i inac- tivedays] [-S] [--stdin] [username] [root@Smoke ~]# Man 5 passwd (Shows what passwd means every colon, in Chapter 5 file format) PASSWD(5) Linux Programmer's Manual PASSWD(5) NAME passwd - password file(User's password file) [root@Smoke ~]# Man man (get man's manual) man(1) man(1) NAME man - format and display the on-line manual pages SYNOPSIS man [-acdfFhkKtwW] [--path] [-m system] [-p string] [-C config_file] [-M pathlist] [-P pager] [-B browser] [-H htmlpager] [-S section_list] [section] name ... man Description of the command: [root@Smoke ~]# Man date (see man help for the date command) DATE(1) User Commands DATE(1) NAME date - print or set the system date and time SYNOPSIS date [OPTION]... [+FORMAT](Brackets[]Omitted if enclosed,...Indicates that it can occur multiple times and that there can be multiple options) date [-u|--utc|--universal] [MMDDhhmm[[CC]YY][.ss]](The middle vertical line indicates two or more choices, only one can be selected and not both) date: date - print or set the system date and time date [OPTION]... [+FORMAT](format) date [-u|--utc|--universal] [MMDDhhmm[[CC]YY][.ss]](Modify system time, month, day, hour, minute, year.second) FORMAT(format): %D date; same as %m/%d/%y(Show month, day and year) %y last two digits of year (00..99)(Show two years) %Y year(Show four years) %d day of month (e.g, 01)(Show the day of the month) %n a newline(Line Break) %T time; same as %H:%M:%S(Show hours, minutes and seconds) %F full date; same as %Y-%m-%d(Show Year, Month and Day) %M minute (00..59)(Minute) %S second (00..60)(Show seconds) %s seconds since 1970-01-01 00:00:00 UTC(Timestamp, Unix Year Timing, the number of seconds elapsed from 00:00:00 on January 01, 1970 to this point) [root@Smoke ~]# Date 0601220514.30 (change system time to 22.05 minutes, 14 years, 30 seconds, June 1) Sun Jun 1 22:05:30 CST 2014 [root@Smoke ~]# Date +%D (showing month, day and year) 06/01/14 [root@Smoke ~]# Date +%Y (showing four-digit years) 2014 [root@Smoke ~]# Date +%y (showing two years) 14 [root@Smoke ~]# Date + This year is%Y This year is 20 [root@Smoke ~]# Date + This year is%Y. (You can display the year as it is with characters and punctuation) This year is 2014. [root@Smoke ~]# Date +%d (shows the day of the month today) 01 [root@Smoke ~]# Date + "This year is%Y. Today is%d." (Displays the year and shows which day of the month is today, with additional character punctuation) This year is 2014. Today is 01. [root@Smoke ~]# Date + "This year is%Y.%nToday is%d." Displays the year and shows which day of the month it is today, with other character punctuation added and displayed on a%n line break) This year is 2014. Today is 01. [root@Smoke ~]# Date +%T (show hours, minutes, seconds) 22:26:14 [root@Smoke ~]# Date +%F (showing year, month and day) 2014-06-01 [root@Smoke ~]# Date +%Y-%m-%d (show year, month, day, horizontal line-separated) 2014-06-01 [root@Smoke ~]# Date +%H:%M (show a few minutes, colon: separated) 22:29 [root@Smoke ~]# Date +%H-%M (show a few minutes, line-separated) 22-30 [root@Smoke ~]# Date +%s (shows timestamp, seconds elapsed since 1970.01.01.00.00) 1401633375
clock: View hardware time, equivalent to hwclock
hwclock: Display hardware time by default
-w: Synchronize system time to hardware, change hardware time
-s: Synchronize hardware time to system time, change system time
-r: Display the hardware time without adding-r.
[root@Smoke ~]# Clock (view hardware time) Sun 01 Jun 2014 10:39:07 PM CST -0.220458 seconds [root@Smoke ~]# Hwclock-w (synchronize system time to hardware, change hardware time) [root@Smoke ~]# Clock (view hardware time) Sun 01 Jun 2014 10:41:11 PM CST -0.127240 seconds [root@Smoke ~]# Date 03151132 (change system time to wrong time) Sat Mar 15 11:32:00 CST 2014 [root@Smoke ~]# Hwclock-s (synchronize hardware time to system time, change system time) [root@Smoke ~]# date Sun Jun 1 22:43:11 CST 2014 [root@Smoke ~]# Man hwclock (see the man documentation for hwclock) [root@Smoke ~]# Hwclock-r (display hardware time) Sun 01 Jun 2014 10:48:40 PM CST -0.112417 seconds
Online Documentation:
info COMMAND
Page flip:
PageUP: Up Translation
PageDown: Context Translation
[root@Smoke ~]# Info ls (view online documentation for ls commands) //Document: /usr/share/doc: Almost all command documents are available. [root@Smoke ~]# Cd/usr/share/doc/(Command Manual Document Directory) [root@Smoke doc]# Ls (view files and subdirectories in directory) abrt-2.0.8 libstdc++-devel-4.4.7 abyssinica-fonts-1.0 libtar-1.2.11 cal: calendar calendar [root@Smoke ~]# Cal (view calendar) June 2014 Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 [root@Smoke ~]# cal 2013(2013 calendar) 2013 January February March Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa 1 2 3 4 5 1 2 1 2 6 7 8 9 10 11 12 3 4 5 6 7 8 9 3 4 5 6 7 8 9 13 14 15 16 17 18 19 10 11 12 13 14 15 16 10 11 12 13 14 15 16 20 21 22 23 24 25 26 17 18 19 20 21 22 23 17 18 19 20 21 22 23 27 28 29 30 31 24 25 26 27 28 24 25 26 27 28 29 30 31 April May June Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 1 2 3 4 1 7 8 9 10 11 12 13 5 6 7 8 9 10 11 2 3 4 5 6 7 8 14 15 16 17 18 19 20 12 13 14 15 16 17 18 9 10 11 12 13 14 15 21 22 23 24 25 26 27 19 20 21 22 23 24 25 16 17 18 19 20 21 22 28 29 30 26 27 28 29 30 31 23 24 25 26 27 28 29 30 July August September Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 1 2 3 1 2 3 4 5 6 7 7 8 9 10 11 12 13 4 5 6 7 8 9 10 8 9 10 11 12 13 14 14 15 16 17 18 19 20 11 12 13 14 15 16 17 15 16 17 18 19 20 21 21 22 23 24 25 26 27 18 19 20 21 22 23 24 22 23 24 25 26 27 28 28 29 30 31 25 26 27 28 29 30 31 29 30 October November December Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa 1 2 3 4 5 1 2 1 2 3 4 5 6 7 6 7 8 9 10 11 12 3 4 5 6 7 8 9 8 9 10 11 12 13 14 13 14 15 16 17 18 19 10 11 12 13 14 15 16 15 16 17 18 19 20 21 20 21 22 23 24 25 26 17 18 19 20 21 22 23 22 23 24 25 26 27 28 27 28 29 30 31 24 25 26 27 28 29 30 29 30 31 [root@Smoke ~]# Cal 12 2012 (December 2012 calendar) December 2012 Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
Practice:
1. Is echo an internal command or an external command?
[root@Smoke ~]# Type echo (see echo command type, internal command) echo is a shell builtin 2,Its role? [root@Smoke ~]# Help echo (see echo command help) [root@Smoke ~]# man echo (see echo commandman documentation) NAME echo - display a line of text(Show a line of text) SYNOPSIS echo [SHORT-OPTION]... [STRING]... echo LONG-OPTION [root@Smoke ~]# Echo (printed text, default line break)
echo default action that prints and wraps whatever text is entered
-n: No line breaks.
[root@Smoke ~]# Echo-n (display text does not wrap) [root@Smoke ~]# echo "The year is 2013. Today is 26." (Display characters) The year is 2013. Today is 26.
3. How do I display "The year is 2013. Today is 26." as two lines?
-e:Turn on backslash escaping
\n:Line break
\: Show the backslash itself
\b:Backspace
\t:Horizontal Tab
\v:Vertical Tab
[root@Smoke ~]# Echo-e "The year is 2013. \nToday is 26." (Displays the string and switches on backslash escaping\n for line breaking with the -e option) The year is 2013. Today is 26. [root@Smoke ~]# Echo-e "The year is 2013. \bToday is 26." (Displays the string and turns on backslash escaping with the -e option\b Backspace to delete. Dot) The year is 2013Today is 26. [root@Smoke ~]# Echo-e "The year is 2013. \bbToday is 26." (Backspace twice) The year is 201Today is 26. [root@Smoke ~]# Echo-e "The year is 2013. \tToday is 26."(Displays the string and turns on backslash escapingtHorizontal tab blanks with the -e option) The year is 2013. Today is 26. [root@Smoke ~]# Echo-e "The year is 2013. \vToday is 26." "(Displays the string and turns on backslash escape\v vertical tab blank with the -e option) The year is 2013. Today is 26. [root@Smoke ~]# Echo-n "The year is 2013." (Display string, -n no line break, default line break_ The year is 2013.[root@Smoke ~]#
Practice:
1. Is printf an internal command or an external command?
[root@Smoke ~]# Type printf (see printf command type, internal command) printf is a shell builtin
2. Its role?
3. How do I display "The year is 2013. Today is 26." as two lines?
[root@Smoke ~]# man printf (see the printf commandman document) NAME printf - format and print data(Format and display data) SYNOPSIS printf FORMAT(format) [ARGUMENT]...(parameter) printf OPTION \n:Line Break [root@Smoke ~]# printf "The year is 2013." (Formats and displays data, no line breaks by default) The year is 2013.[root@Smoke ~]# [root@Smoke ~]# printf "The year is 2013.\n" (format and display data, use \n to wrap; no wrap by default) The year is 2013. [root@Smoke ~]# printf "The year is 2013.\nToday is 26." (Formats and displays data and wraps two lines of string with \n, but the last line has not been wrapped) The year is 2013. Today is 26.[root@Smoke ~]# [root@Smoke ~]# printf "The year is 2013.\nToday is 26.\n" (formats and displays data and wraps both lines of characters in \n) The year is 2013. Today is 26.
file command and its usage:
The file command detects the type of a given file.File command checks files into three processes: file system, magic number checking and language checking.
grammar
File (options) (parameters)
option
-b: Do not display file names when listing identification results; -c: Detail instructions execution to facilitate troubleshooting or parser execution; -f<name file>: Specify name files whose contents have one or more file names so that files are recognized sequentially in the format of one file name per column; -L:Show the file category that the symbolic link refers to directly; -m<magic number file>: specify magic number file; -v:display version information; -z:try to interpret the contents of the compressed file.
parameter
File: To determine the type of file list, multiple files are separated by spaces and can be matched with multiple shell wildcards
[root@localhost ~]# file install.log install.log: UTF-8 Unicode text [root@localhost ~]# File-b install.log <==Do not display file name UTF-8 Unicode text [root@localhost ~]# File-i install.log <==Displays MIME categories. install.log: text/plain; charset=utf-8 [root@localhost ~]# file -b -i install.log text/plain; charset=utf-8