Configuration file
- . BASHRC/.ZSHRC
Save personal personalization settings, such as command aliases, paths, and so on. The. BASHRC is typically called explicitly in the. bash_profile file. Log in to Linux to start bash first read the ~/.bash_profile file, so that ~/.BASHRC will be executed, your personalized settings will be effective
System administrators manage files for users and user groups
- /etc/passwd
- /etc/shadow
- /etc/group
- /etc/gshadow
File Directory Operation cat
- Three major functions
1. Display the entire file at once: Cat filename
2. Create a file from the keyboard: cat > FileName can only create new files and cannot edit existing files.
3. Merge several files into one file: Cat file1 file2 > file
- -b,–number-nonblank number of non-null output lines
-n,–number the number of all rows of the output, starting from 1 for the number of rows for all outputs
-n log2012.log> log2013.log
- TAC Log.txt Reverse Listing
Head/tail
- Head-n 5 Log2014.log Display the first n rows of a file
- Head-c Log2014.log Display the first n bytes of a file
- Head-c -32 log2014.log file except for the last n bytes
- Head-n-6 log2014.log output file except the last n rows of the entire content
More/less
- More +3 Log2012.log Displays the contents of the file from line 3rd
- More +/day3 Log2012.log finds the first line from a file that appears with the "Day3" string, and displays the output from the first two lines at that point
- More-5 Log2012.log Set the number of rows per screen
- Ls-l | More-5
Mv
- -f:force mandatory Meaning, if the target file already exists, will not be asked and directly covered;
- -T: –target-directory=directory move all source arguments into directory, which is the target directory for the specified MV, which is suitable for moving multiple source files to a directory, when the target directory is in front, The source file is behind.
nl
The NL command is used in a Linux system to calculate the line number of a file. NL can automatically add a line number to the output file content! Its default result and cat-n a bit different, NL can do more than the line number display design, including the number of digits and whether auto-completion 0, etc.
Rm
Custom Recycle Bin
Open the. bashrc or. zshrc file and add the following command at the rear:
myrm(){ D=/tmp/$(date +%Y%m%d%H%M%S$D; "[email protected]"$D"moved to $D ok"; }alias myrm=‘myrm‘
Source. ZSHRC is in effect, you can use the Myrm command.
Touch
-R Sets the date and time of the specified document or directory to the same date and time as the reference document or directory
-rlog.log log2012.log
-T uses the specified datetime instead of the current time format [[cc]yy]mmddhhmm[. SS]
-t201211142234.50log.log
File Lookup Find
- Find. -size +1000c-print find files larger than 1K in the current directory
Locate
Ocate allows users to quickly search the file system for specific files. The method is to set up a database that includes all the file names and paths within the system, and then simply query the database when looking for it, rather than actually going deep into the file system. In the general distribution, the establishment of the database is placed in the crontab automatic execution
PS: Sometimes the computer may not have locate command, this time need to install mlocate, and then use UpdateDB to update it.
Whereis
The Whereis command locates the location of the executable file, the source code file, the Help file in the file system
*-B Locate executable file, binary file
*-M location Help file
*-S location source code file
which
The purpose of the which command is to search for the location of a system command in the path specified by the path variable, and return the first search result
File package upload and download
- Differentiate between packaging and compression
Packaging refers to a large number of files or directories into a total file, compression is a large file through some compression algorithm into a small file. Many of the compression programs in Linux can only be compressed for one file, so when you want to compress a lot of files, you have to first make a package (tar command) of this large number of files, and then compress the program (gzip bzip2 command).
Use SecureCRT to upload and download file tar
Used to compress and decompress files. The tar itself does not have compression capabilities. It is implemented by invoking the compression function
- -X extracting files from compressed files
- -Z Support gzip unzip files
- -C Create a new compressed file
- -V Show Operation procedure
- -f Specifies the compressed file
-D Record File differences
FileNameFileName.tar DirName
.gz解压1FileName.gz解压2FileNameFileName
.tar.gz.tgz解压:tar zxvf FileName.tar.gz压缩:tar zcvf FileName.tar.gz DirName
.bz2解压1FileName.bz2解压2FileNameFileName
.tar.bz2解压:tar jxvf FileName.tar.bz2压缩:tar jcvf FileName.tar.bz2 DirName
.bz解压1:bzip2 -d FileName.bz解压2:bunzip2 FileName.bz压缩:未知
.tar.bz解压:tar jxvf FileName.tar.bz压缩:未知
FileNameFileName
.tar.Z解压:tar Zxvf FileName.tar.Z压缩:tar Zcvf FileName.tar.Z DirName
.zip解压:unzip FileName.zip压缩:zip FileName.zip DirName
.rarx FileName.rar压缩:rar a FileName.rar
File Permission Settings chgrp
Use the CHGRP directive to change the group to which files and directories belong
- Group and group identifiers can be viewed in the/etc/group file.
- -V Run-time display verbose processing information
–dereference acts on the point of a symbolic link, not the symbolic link itself
-v bin log2012.log--reference=log2012.log log2013.log-R-R100 test6
Chown command
Change the file owner and group by Chown. You can use the user name and user identification number settings when you change the owner or group of the file. Ordinary users cannot change their files to other owners. Its operation permissions are generally administrators.
Disk storage related DF
- Necessary parameters
- -A All File system list
- -h easy to read mode display
- -H equals "-H", but the formula, 1k=1000, rather than 1k=1024
- -I display inode information
- -K block is 1024 bytes
- -L show local file system only
- -M block is 1048576 bytes
- –no-sync Ignore sync command
- -P output format POSIX
- –sync perform the sync command before obtaining the disk information
- -T File system type
- Select parameters
- –block-size=< Chunk Size > specified chunk size
- -t< file system type > show only disk information for selected file systems
- -x< file System type > does not display disk information for the selected file system
- Help Display Help information
- –version displaying version information
Du
暂时使用的较少,不详述
Performance monitoring and optimization top
Displays information about the processes currently being executed by the system, including process IDs, memory usage, CPU utilization, etc.
- Common parameters
- -B Batch Processing
- -C Displays the complete ruling command
- -I ignores the failure process
- -S Secret mode
- -S cumulative mode
- -i< time > Set time interval
- -u< User name > Specify user name
- -p< Process number > Specify process
- -n< number of times > cycle display
- Example
- The first line: The current system time, up xxx running for how long, the current 1 users logged in, load average the three numbers are 1 minutes, 5 minutes, 15 minutes of the load situation. If this number is divided by the number of logical CPUs, the results above 5 indicate that the system is overloaded.
- Second line: Total number of processes, zombie is zombie
- PID line: Process ID; Process owner; Process priority (PR); Nice value, negative indicates high priority, positive values represent low priority; VIRT, total amount of virtual memory used by the process, in kilobytes. Virt=swap+res;res, the size of the physical memory, in kilobytes, that the process uses and has not been swapped out. Res=code+data;
Free
The free command displays system usage and idle memory conditions, including physical memory, interactive area memory (swap), and kernel buffer memory. Shared memory will be ignored
Vmstat/iostat Command/lsof command
还没接触到,先不做解释http://www.cnblogs.com/peida/archive/2012/12/25/2833108.html
Network Command Ifconfig
The NIC information configured with the Ifconfig command does not exist after the machine restarts after the network card restarts. In order to keep the above configuration information in the computer forever, it is necessary to modify the network card configuration file.
rcp (remote file copy)
The RCP command copies files or directories at the remote end, such as specifying more than two files or directories at the same time, and the final destination is a directory that already exists, it will copy all previously specified files or directories to that directory.
SCP (Secure copy)
SCP Transfer is encrypted
- Command format: SCP [parameter] [original path] [Target path]
- command Parameters
- -1 Force SCP command to use protocol SSH1
- -2 Enforce SCP command using protocol SSH2
- -4 Force SCP command to use only IPV4 addressing
- -6 Forcing the SCP command to use only IPV6 addressing
- -B uses batch mode (no transmission password or phrase is queried during transfer)
- -C allows compression. (Pass the-c flag to SSH to turn on compression)
- -P retains the original file's modification time, access time, and access rights.
- -Q does not display the transfer progress bar.
- -R recursively replicates the entire directory. The
- -v verbose displays the output. SCP and SSH (1) will display debugging information for the entire process. This information is used to debug connections, authentication, and configuration issues.
- -C cipher encrypts the data transfer with cipher, which is passed directly to SSH.
- -F ssh_config Specifies an alternate SSH configuration file that is passed directly to SSH.
- -I identity_file the key file that is used when transferring from the specified file, and this parameter is passed directly to SSH. The
- -L limit limits the bandwidth that users can use, in kbit/s.
- -O ssh_option If you are accustomed to using parameter passing in Ssh_config (5),
- -P port Note is uppercase P, port is the port number specified for data transfer
- -S prog RAM Specifies the program that is used to encrypt the transfer. This program must be able to understand the options for SSH (1).
Instance
Replicating from a local server to a remote server
scp local_file remote_username@remote_ip:remote_folder/fileremote_ip:
Copying from a remote server to a local server
scp root@192.168.120.204:/opt/soft/nginx-0.5.38.tar.gz /opt/soft/
Route/traceroute/netstat/ss to Be Continued ...
Advanced Linux Commands