Beginners Linux System, looking at the bird Brother's Linux Private dishes Basic Learning Chapter (third edition), still in the reading stage, the feeling is the command and parameters do not remember, there are various permissions settings, the first collation of these commonly used commands, in order to use the lookup.
One: Use CentOS common commands to view the CPU
More/proc/cpuinfo | grep "model name"
grep "model name"/proc/cpuinfo
[Root@localhost/]# grep ' CPU '/proc/cpuinfo
Model Name:intel (R) Pentium (r) Dual CPU E2180 @ 2.00GHz
Model Name:intel (R) Pentium (r) Dual CPU E2180 @ 2.00GHz
If you feel the need to look more comfortable
grep "model Name"/proc/cpuinfo | Cut-f2-d:
Two: Use CentOS common command to view memory
grep memtotal/proc/meminfo grep memtotal/proc/meminfo | cut-f2-d: free-m |grep "Mem" | awk ' {print $} '
Three: Use CentOS common command to see whether the CPU is 32-bit or 64-bit
View CPU digits (64 or)
Getconf Long_bit
Four: Use CentOS common commands to view the current Linux version
More/etc/redhat-release
Cat/etc/redhat-release
V: Use CentOS common commands to view the kernel version
Uname-r
Uname-a
VI: Use CentOS common commands to view the current time
Date above describes how to sync time.
Seven: Use CentOS common command to view hard disk and partition
Df-h
Fdisk-l
You can also view partitions
Du-sh
You can see all the space occupied
Du/etc-sh
You can see the size of this directory
Eight: Use CentOS common commands to view installed packages
Check the package installed on the system
Cat-n/root/install.log
More/root/install.log | Wc-l
View the packages that are now installed
Rpm-qa
Rpm-qa | Wc-l
Yum List Installed | Wc-l
It's strange, though, that the number of installation packages I've queried through RPM, and Yum, is not the same. No reason was found.
Nine: Use CentOS common commands to view the keyboard layout
Cat/etc/sysconfig/keyboard
Cat/etc/sysconfig/keyboard | grep KEYTABLE | Cut-f2-d=
Ten: Use CentOS Common command to view SELinux situation
Sestatus
Sestatus | Cut-f2-d:
Cat/etc/sysconfig/selinux
11: Use CentOS Common command to view Ip,mac address
In the Ifcfg-eth0 file you can see the Mac, Gateway and other information. Ifconfig Cat/etc/sysconfig/network-scripts/ifcfg-eth0 | grep ipaddr Cat/etc/sysconfig/network-scripts/ifcfg-eth0 | grep ipaddr | cut-f2-d= ifconfig eth0 |grep "inet addr:" |awk ' {print $} ' |cut-c 6-ifconfig | grep ' inet addr: ' | Grep-v ' 127.0.0.1 ' | Cut-d:-f2 | awk ' {print} ' view Gateway cat/etc/sysconfig/network view DNS cat/etc/resolv.conf
12: Use CentOS common commands to view the default language
Echo $LANG $LANGUAGE
cat/etc/sysconfig/i18n
12: Use CentOS Common command to view the time zone and whether to use UTC
Cat/etc/sysconfig/clock
13: Use CentOS Common command to view host name
Hostname
Cat/etc/sysconfig/network
Modifying the hostname is to modify the file, and it is best to modify the host file as well.
14: Use CentOS Common command to view the boot run time
Uptime
09:44:45 up, 23:32, ...
It seems that the problem is a network segment, my machine is still 67 days before the boot.
#系统资源使用情况
Vmstat 1-s m procs-----------memory-------------Swap-------io------System-------CPU------r B swpd free buff cache S I so bi bo in CS us sy ID WA St 0 0 0 233 199 778 0 0 4 25 1 1 3 0 96 0 0 0 0 0 233 199 778 0 0 0 0
In a number of Linux terminal commands, we should classify to introduce, here first said file directory class, drive Mount class, program installation class, compression decompression class, Process Control class, here all the Linux terminal commands will be used frequently, familiar with these commands should be able to work a lot easier.
A, file directory class
1. Create directory: mkdir directory name
2. Delete Empty directory: RmDir directory name
3. Delete the subdirectory unconditionally: RM-RF directory Name
4. Change the current directory: CD directory name (enter user home directory: cd ~; go to the previous level directory: CD-)
5. View your directory: PWD
6. View current directory size: Du
7. Display directory file list: Ls-l (-A: increasing the display of hidden directories)
of which: blue: directory; green: executable file; red: compressed file; light blue: Link file; Gray: Other file; white: Wrong link file
8. Browse Files: more filename. txt;less file name. txt
9. Copy file: CP source File Destination file (-r: Include directory)
10. Look up files: (1) Find (2) Locate command name
11. Links: (1) Establish hard link: ln source file Link file (-d: Create directory link);(2) Establish symbolic Link: ln-s source file Link file
Two. Drive Mount class
1. Check hard disk usage: df-t-H
2. Check Disk partitions: fdisk-l
3. Mount Soft Hard light area: mount-t/dev/fdx|hdax/mnt/directory Name
Which:: modos--fat16;vfat--fat32;ntfs--ntfs; optical drive--iso9660
Support Chinese name: Mount-o iocharset=x/dev/hdax/mnt/directory Name (of which: x=cp936 or
Mount Optical drive: mount-t auto/dev/cdrom/mnt/cdrom
Mount ISO file: mount-t iso9660-o loop Xxx.iso/path
4. Lifting mount: umount/mnt/directory Name
To remove all mounts: umount-a
5. Establish the file system: Mkfs-t/dev/hdxx. Among them: Ftype:ext2, ext3, swap, etc.
Three. Program Installation class
1.RPM Package Installation:
(1) Install RPM-IVH somesoft.rpm
(2) Reverse installation (uninstall) Rpm-e somefost.rpm
(3) Query rpm-q somefost or Rpm-qpi somefost.rpm (of which: P is not installed; I contains information)
(4) After the installation of the query location: RPM-QL somefost.rpm
(5) Upgrade installation: RPM-UVH somesoft.rpm
(6) Forced installation: Rpm-ivh--nodeps somesoft.rpm or RPM-IVH--nodeps--force
2. Source Code Package Installation:
Check the Readme
Basic usage
(1) Configuration: Extract the directory./configure
(2) Compile: Unzip the directory make
(3) Installation: Extract the directory make install
Installation of 3.src.rpm
Four. Compression Decompression class
Tar command: tar [-cxtzjvfppn] files and directories ....
Tar command parameters:
-C: Create a compressed file parameter instruction (create meaning);
-x: Unlock a parameter command for a compressed file!
-T: View the files inside the Tarfile!
In particular, in the release of the parameters, c/x/t can only exist one! Cannot exist at the same time!
Because it is not possible to compress and decompress at the same time.
-Z: Do you also have gzip properties? That is, is it necessary to use gzip compression?
-j: Do you have bzip2 properties at the same time? Is it necessary to use BZIP2 compression?
-V: Displaying files during compression! This is commonly used, but is not recommended in the context of the implementation process!
-F: Use file name, please note that after F to immediately receive file name Oh! No more Parameters!
For example, the use of "TAR-ZCVFP tfile sfile" is the wrong way to write
"TAR-ZCVPF tfile sfile" is right!
-P: Use the original properties of the original file (properties will not be changed according to the user)
-P: You can use absolute paths to compress!
-N: Newer than the following date (YYYY/MM/DD) will be packaged into the newly created file!
–exclude file: Do not package file in the process of compression!
Example:
Example one: Package all the files in the/etc directory into a/tmp/etc.tar
[Root@linux ~]# tar-cvf/tmp/etc.tar/etc<== only packaged, not compressed! TAR-CVF target file source file (in the same below) For example: TAR-CVF A.txt.tar a.txt
[Root@linux ~]# tar-zcvf/tmp/etc.tar.gz/etc<== after packaging, gzip compressed
[Root@linux ~]# tar-jcvf/tmp/etc.tar.bz2/etc<== after packaging to bzip2 compression
# Note that the file name after the parameter F is taken by itself, and we are accustomed to using the. Tar as an identification.
# If you add the z parameter, the. tar.gz or. tgz to represent the gzip-compressed tar file ~
# If you add the J parameter, use the. tar.bz2 as the file name.
# The above instruction will display a warning message when it is executed:
# "tar:removing leading"/"from member names" is a special set of absolute paths.
Example two: What documents are available in the above/tmp/etc.tar.gz document?
[Root@linux ~]# tar-ztvf/tmp/etc.tar.gz
# Since we use gzip compression, we need to check the files in the tar file
# We're going to have to add the Z-parameter! It's important!
Example three: Unzip the/tmp/etc.tar.gz file under/USR/LOCAL/SRC
[Root@linux ~]# CD/USR/LOCAL/SRC
[Root@linux src]# tar-zxvf/tmp/etc.tar.gz
# in a preset case, we can undo the compression file anywhere! In this example,
# I first transform the working directory underneath the/USR/LOCAL/SRC and unlock the/tmp/etc.tar.gz,
# then the unpacked catalogue will be in/USR/LOCAL/SRC/ETC! In addition, if you enter the/USR/LOCAL/SRC/ETC
# you will find that the file attributes in this directory may be different from the/etc/.
Example four: under/tmp, I just want to untie the etc/passwd in the/tmp/etc.tar.gz.
[Root@linux ~]# Cd/tmp
[Root@linux tmp]# tar-zxvf/tmp/etc.tar.gz etc/passwd
# I can check the file name in the Tarfile through TAR-ZTVF, if only one file
# It can be done in this way! notice! The root directory within the etc.tar.gz/was taken away!
Example five: Back up all the files in the/etc/and save their permissions!
[Root@linux ~]# Tar-zxvpf/tmp/etc.tar.gz/etc
# This property of-p is important, especially if you want to preserve the properties of the original file!
Example six: In/home, a new file is backed up in 2005/06/01
[Root@linux ~]# tar-n "2005/06/01″-ZCVF home.tar.gz/home
Example seven: I want to back up/home,/etc, but don't/home/dmtsai
[Root@linux ~]# TAR–EXCLUDE/HOME/DMTSAI-ZCVF myfile.tar.gz/home/*/etc
Example eight: The/etc/package will be unpacked directly to the bottom of/tmp, without producing a file!
[Root@linux ~]# Cd/tmp
[Root@linux tmp]# TAR-CVF-/etc | TAR-XVF-
# This action is a bit like cp-r/etc/tmp ~ still has its use!
# The place to notice in the output file becomes-and the input file becomes-, and there's a | exist ~
# This separately represents standard output, standard input and Pipeline command!
Five. Process Control class
1. List the current process Id:ps-auxw
2. Terminate process: (1) Terminate single process: Kill process ID Number
(2) Terminate the program All processes: Killall program name
(3) Terminate X-window procedure: Xkill
3. View Resource Usage: (1) Top (2) Free (3) DMESG
4. View environment variable Value: ENV
5. Restart: (1) Reboot (2) Ctrl Alt Del (3) Init 6
6. Shutdown: (1) Shutdown-h now (2) halt (3) Init 0
7. Switch Desktop: Switchdesk gnome| Kde| ...