Linux basic knowledge "turn"

Source: Internet
Author: User
Tags clear screen locale set time disk usage

LinuxDirectory Schema
/root directory
/bin common commands for binary file
/boot files that must be read when the system is started, including the core (kernel)
/boot/grub/menu.lst Grub Settings
/boot/vmlinuz kernel
/BOOT/INITRD Core compression Required RAM Disk
/dev System Peripheral Equipment
/etc system Related settings file
/etc/dir_colors Setting the Color
/etc/hostname setting the user's node name
/etc/networking only yes indicates network presence
The/etc/host.conf file describes how the user's system queries the node name
/etc/hosts set the user's own IP and name corresponding table
/etc/hosts.allow settings allow use of inetd machines
/etc/hosts.deny settings are not allowed for use with inetd machines
/ETC/HOSTS.EQUIV setting remote machine without password
/etc/inetd.conf setting the configuration of the System network daemon inetd
/etc/gateways setting up the router
/etc/protocols setting System-supported protocols
/etc/named.boot setting the configuration file for the name server
/etc/sysconfig/network-scripts/ifcfg-eth0 Setting IP
/etc/resolv.conf Setting up DNS
/etc/x11 X Window's configuration file, xorg.conf or xf86config the two X Server settings
/etc/fstab record the file system to mount on boot
/etc/inittab sets the system to what the INIT process will set when the system starts RunLevel
/etc/issue record the information displayed before the user logs in
/etc/group Setting the user's group name and related information
/ETC/PASSWD account Information
/etc/shadow Password Information
/etc/sudoers can be the sudo command configuration file
/etc/securetty set which terminal can let root login
/etc/login.defs default configuration for all users when they log on
/etc/exports to set up NFS systems
/etc/init.d/All service presets are placed here, for example, to activate or close
/etc/xinetd.d/This is the set of services that are called Super Daemon Management
/etc/modprobe.conf Kernel module Additional parameter setting
/etc/syslog.conf Log Settings file
/Home User House Directory
Library of functions to be used by the/lib system
/lib/modules kernel-related modules
/var/lib/rpm RPM Kit Installation
When the/lost+found system is wrong, some of the missing fragments are placed in this catalogue
Mount points for/mnt Peripherals
/media is similar to/mnt
Additional software installed on the/OPT host
/proc virtual directory, which is a mapping of memory
/proc/version kernel version
/proc/sys/kernel System kernel functions
/root system Administrator's home directory
/sbin instructions for system administrators to execute
/srv After some service is initiated, these services require access to the information
/TMP general user or where the program is being executed to place the file at a temporary time
/usr largest directory, save applications and files
/usr/x11r6:x-window Directory
/usr/src:linux Source Code
/usr/include: System Header File
/usr/openwin Storing Sun's Openwin
/usr/man Online User Manual
/usr/bin the binary file that the user can perform
/usr/local/bin the binary file that the user can perform
Library of functions to be used by the/usr/lib system
Library of functions to be used by the/usr/local/lib system
/usr/sbin instructions for system administrators to execute
/usr/local/sbin instructions for system administrators to execute
/var log file
/var/log/secure log in to the system access file, such as POP3, SSH, Telnet, FTP, etc. will be recorded in this file
/var/log/wtmp records the information of the logged-in person, last
/var/log/messages a few of the system's wrong messages
/var/log/boot.log when a startup or some service is started, the activation or the message that is displayed
User records for/var/log/maillog (SendMail and POP3) in your Inbox
/var/log/cron crontab The content of this routine service
/VAR/LOG/HTTPD,/var/log/news,/var/log/mysqld.log,/var/log/samba,/var/log/procmail.log:
A couple of different Web service records.

some common basic commands
Uname-a Viewing the kernel version
Ls-al Show properties for all files
PWD Displays the current path
CD-Back to previous catalog CD ~ Back to home directory
Date s set time, date
CAL Displays calendar Cal 2006
BC Computing Appliances
Man & Info Help manual
Locale Displays the current font locale-a all available fonts/etc/sysconfig/i18n settings file
Lang=en using English fonts
Sync writes data to the hard disk
Shutdonw-h now & half & Poweroff shutdown
Reboot restart
StartX & Init 5 entering the graphics interface
/work & Work up and down find document content
Chgrp Change file group CHGRP testing Install.log
Chown Change the owner Chown Root:root Install.log
Chmod change Properties chmod 777 Install.log read=4 write=2 execute=1
CP copy CP filename
RM Delete file rm-rf filename Force Delete file
RmDir Deleting a folder
MV Mobile MV 123.txt 222.txt Rename
mkdir Creating a Folder
Touch Create file Update current time
Cat |more page starts with the first line
NL Add line number in front of content
More & Less flip side
Head-n filename Displays the nth line of content
Tail-n filename Displays the contents of the following n rows
OD displays non-pure documents
Df-h Show Partition space
Du displays the size of a directory or file
Fdisk partition settings fdisk-l/dev/hda show hard disk partition status
MKFS set up various file systems Mkfs-t EXT3/DEV/RAM15
FSCK checks and repairs linux files
ln hard link ln-s software link
Whereis Find command
Locate find
Find finds/-name "***.***"
Which viewing tools
WHOAMI Show Current User
GCC-V View GCC versions
chattr +i filename Suppresses deletion of chattr-i filename cancellation ban
Lsattr Show hidden file properties
UpdateDB Update Repository
MKE2FS Formatting mkfs-t ext3
DD IF=/ETC/PASSWD Of=/tmp/passwd.bak Backup
Mount lists all of the system's partitions
Mount-t Iso9660/dev/cdrom/mnt/cdrom Mount Disc
MOUNT-T vfat/dev/fd0/mnt/floppy Mount floppy disk
MOUNT-T Vfat-o IOCHARSET=UTF8,UMASK=000/DEV/HDA2/MNT/HDA2 Mount FAT32 partition
MOUNT-T ntfs-o NLS=UTF8,UMASK=000/DEV/HDA3/MNT/HDA3 Mount NTFS partition
Linux-ntfs project:http://linux-ntfs.sourceforge.net/
Umount/mnt/hda3 Unloading load
Ifconfig display or set up network devices
Service Network restart restart NIC
Ifdown eth0 turn off the NIC
Ifup eth0 Open NIC
Clear Clear Screen
Historical history!55 execution of the 55th directive
Stty Set Terminal stty-a
FDISK/MBR Delete Grub
At only one job scheduling
Crontab routine commands [e] edit, [l] display, [R] Delete task
& Background Run program TAR-ZXVF 123.tar.gz & Background Run
Jobs watch the backstage suspended program Jobs-l
FG will set the daemon to the foreground FG N N is a number, you can specify that the program
BG lets work run in the background
Kill End Process Kill-9 PID [9] forced end, [15] normal end, [l] list available kill signals
PS aux view background program
Top View Daemon top-d 2 update every two seconds top-d 2-p10604 watch a PID
Top-b-N 2 >/tmp/top.txt the top information 2 times and then outputs the results to/tmp/top.txt.
Pstree Displays the program [A] in ASCII, [u] lists the PID, [p] lists the account number
Killall to erase a service killall-9 httpd
Free display memory status free-m in M
Uptime display current system boot time
Netstat display the network status NETSTAT-TULNP find out what is currently in the system, and its PID
DMESG display boot Information demsg | More
Nice set Priority Nice-n-5 VI & with root for a nice value of-5, for the execution of VI
Renice adjustment already exists priority
RunLevel shows the current runlevel
Depmod analysis of the dependencies of the loaded modules
Lsmod displaying modules loaded into the system
Modinfo displaying information for kernel modules
Insmod Loading Module
modprobe automatic handling of loading modules
Rmmod Deleting a module
Chkconfig check, set the system's various services Chkconfig--list list each service status
NTSYSV set up various services for the system
Cpio Backup Files


Compress Command
*. Z Compress program-compression files;
*.BZ2 bzip2 program compression files;
*.gz gzip program compression files;
The *.tar tar program is packaged with no compression;
*.tar.gz tar package files, which are also compressed by gzip
Compress filename Compressed file plus [-d] Decompression uncompress
gzip filename compression plus [-d] Unzip zcat 123.gz View compressed file contents
bzip2-z filename compression plus [-d] Unzip bzcat filename.bz2 View compressed file contents
TAR-CVF/HOME/123.TAR/ETC Packaging, no compression
TAR-XVF 123.tar Untied Bag
Tar-zxvf/home/123.tar.gz with gzip decompression
TAR-JXVF/HOME/123.TAR.BZ2 Decompression with bzip2
tar-ztvf/tmp/etc.tar.gz View tar Content
Cpio-covb > [File|device] Share
Cpio-icduv < [file|device] Restore

VIGeneral Usage
General mode edit mode instruction mode
H Left A,i,r,o,a,i,r,o:w Save
J down into edit mode: w! Force Save
K on DD Delete cursor current line: q! Do not save leave
L Right NDD delete n rows: wq! Leave after saving
0 move to beginning yy copy current line: e! Restore Original file
$ move to end of line NYY copy n rows: Wfilename Save As
H screen Top p,p paste: Set Nu sets line number
M Screen Center U undo: Set Nonu cancel line number
L screen Bottom [ctrl]+r redo on an action ZZ save left
G file last line [Ctrl]+z pause exit: Set Nohlsearch permanently turn off highlighting
/work Search down: SP Open two documents at a time
Work up search [ctrl]+w two document Changer
GG move to the first line of archives: Nohlsearch temporarily turn off highlighting

knowSHELL
Alias displays all current command aliases alias lm= "Ls-al" command alias unalias lm cancel command alias
Type similar to which
Exprot setting or displaying environment variables
Exprot path= "$PATH":/sbin add/sbin into path
echo $PATH Display path Path
Bash enters subroutines
Name=yang Setting variables
unset name Cancel Variable
echo $name Display the contents of a variable
Myname= "$name its Me" &myname= ' $name its me ' single quote $name loss of variable contents
ciw=/etc/sysconfig/network-scripts/Setting the path
ENV Lists all environment variables
The echo $RANDOM shows the randomly generated number
Set Settings shell
Ps1= ' [\[email protected]\h \w \a #\#]\$ ' prompt character setting
[[email protected] ~]# read [-pt] variable-----------read the keyboard input variables
Parameters:
-P: The rear side can receive prompt characters!
-T: The number of seconds to wait on the back side! 』
Declare declaring shell variables
Ulimit-a Show all restricted data
Ls/tmp/yang && echo "Exist" | | echo "not exist"
The meaning is that when ls/tmp/yang, if it is correct, execute the echo "exist", if there is a problem, execute echo "not exist"
echo $PATH | Cut-d ': '-F 5 to: Read the 5th paragraph as a delimiter
Export | Cut-c 10-20 reads the contents of a 10th to 20th byte
Last | grep ' root ' searches for a root line, plus [-v] Reverse Search
cat/etc/passwd | Sort sorted Display
cat/etc/passwd | WC display "line, word count, number of bytes"
formal notation
[[email protected] root]# grep [-ACINV] ' search string ' filename
The parameters say:
-A: Search for binary files in text file mode
-C: Calculate the number of "search string"
-I: Ignore the difference in size, so the size is the same
-N: Travel number
-V: Reverse selection, which shows the line without the ' search string ' content!
Grep-n ' The ' 123.txt search the character for a specific string
Grep-n ' t[ea]st ' 123.txt search test or taste two characters using [] searching for collection characters
Grep-n ' [^g]oo ' 123.txt search for OO selection not in front of G [^]
Grep-n ' [0-9] ' 123.txt search has 0-9 numbers
Grep-n ' ^the ' 123.txt search by the beginning of the start of the line ^
Grep-n ' ^[^a-za-z] ' 123.txt search does not start with the English alphabet
Grep-n ' [a-z]$ ' 123.txt search for end of line in a-Z search $
Grep-n ' G.. d ' 123.txt search begins with G end D character any one character.
Grep-n ' ooo* ' 123.txt search for at least two Oo character re-bytes *
Sed text flow editor uses script commands to process text files
AWD mode scanning and processing languages
NL 123.txt | Sed ' 2,5d ' deletes content from second to fifth lines
Diff Compare file differences
CMP compares two files for differences
Patch Patch files
PR to print the file format


Account Management
/ETC/PASSWD System Account Information
/etc/shadow account password information by MD5 32-bit encryption
In front of the password bar, add "*" "!" Prohibit use of an account
/etc/group System Group Information
/etc/gshadow
NEWGRP Change Login Group
Useradd & AddUser Set up a new user Useradd-m test automatically establishes the user's login directory
Useradd-m-G Pgroup test specifies the owning level
/etc/default/useradd Related Settings
/etc/login.defs Uid/gid-Related settings
passwd Change Password passwd test
Usermod Modifying user accounts
Userdel Delete Account Userdel-r test
Chsh the shell [-l] used when changing the login system displays the available shells; [-S] Modify your shell
CHFN change the information displayed by the finger command
Finger finding and displaying user information
ID Displays the user's ID ID test
Groupadd adding groups
Groupmod is similar to Usermod
Groupdel Deleting a group
Su test changes user Su-enters root, and uses the root environment variable
sudo executes instructions in other identities.
Visudo Edit/etc/sudoers Add a line "Test all= (All) All"
%wheel all = (all) users of all wheel groups in all systems are available with sudo
%wheel all = (all) Nopasswd:all Wheel Group All users do not have a password nopasswd
User_alias ADMPW = Vbird, Dmtsai, vbird1,vbird3 join ADMPW Group
ADMPW all = nopasswd:!/usr/bin/passwd,/usr/bin/passwd [a-za-z]*, \
!/USR/BIN/PASSWD root can change the user password, but cannot change the root password (added before the command!)
PAM (pluggable authentication Modules, embedded modules)
Who & W See who Online
Last recently logged in host information
Lastlog recently logged in read/var/log/lastlog
Talk with other users
Write send message write test [ctrl]+d send
MESG Setting the Write permission of the terminal MESG N disables receiving MESG y
Wall send information to all users wall this is Q test
Mail Write Mail
/etc/default/useradd Home Directory default settings
Quota Displays the space and limits that the disk has used Quota-guvs show the current root's own quota limit value
Quota-vu Query
Quotacheck Check disk usage space and Restrictions quotacheck-avug all the partition in/etc/mtab with quota support.
[-m] Force scan
Quota must be a separate partition, to have Quota.user and quota.group two pieces of files, add a sentence in/etc/fstab:
/dev/hda3/home Ext3defaults,usrquota,grpquota 1 2
chmod quota* Setup complete, reboot effective
Edquota Edit user or group quota [u] user, [G] group, [p] copy, [T] set grace period
Edquota-a Yang edquota-p yang-u young copy
Quotaon Open disk space limit QUOTAON-AUVG all filesystem with quota
Quotaoff shut down the disk space limit quotaoff-a close the quota limit
Repquota-av all of the quota filesystem's limit status in the system.
Quota The main steps from the beginning of the preparation of the filesystem support to the entire set-up are probably:
1, set the partition filesystem support quota parameters:
Since quota must allow partition to support the filesystem above, generally speaking, the best support is EXT2/EXT3,
The other filesystem I didn't try! The most simple way to activate filesystem support quota is to edit/etc/fstab,
The quota disk that is ready to be released can support quota;
2. Establish Quota records:
As I mentioned earlier, the entire quota disk limit record file is Aquota.user/aquota.group,
To build these two files, you have to use Quotacheck to scan the first.
3, edit quota limit value information:
Again, use Edquota to edit the available space for each user or group;
4. Re-scan and activate quota:
After setting the quota, the suggestion can be quotacheck again, and then quotaon to activate it!

Introduction to the start-up process
1. Load the BIOS hardware and obtain the first device's replacement;
2. Read the opening information of the first MBR boot Loader (i.e. Lilo, GRUB, Spfdisk, etc.).
3. Download the Kernel system core information, Kernel start to decompress, and try to move all the hard devices;
4, Kernel execute the INIT program and obtain run-level information;
5, init/etc/rc.d/rc.sysinit files;
6, the activation core of the outer Die Group (/etc/modprobe.conf);
7. init performs run-level batch files (Scripts);
8, init/etc/rc.d/rc.local files;
9. Execute the/bin/login program and wait for the user to log in;
10. After logging in, start with the Shell control master machine.
In/etc/rc.d/rc3.d, starts with S start, begins with K, turns off, and then the number represents the order of execution.
GRUB VGA settings
Color \ Resolution 640x480 800x600 1024x768 1280x1024 bit
769 771 773 775 8 Bit
32768 784 787 790 793
65536 785 788 791 794-bit
16.8M 786 789 792 795 + bit

./configure check System information./configure--help | More help information
Make clean clears the files left before
Make compilation
Make install Installation
Rpm-q query whether to install RPM-QL query all directories of the suite
Rpm-qi Query Kit Description RPM-QC[D] Profiles and documentation
RPM-IVH installation rpm-v See if the kit has been altered
RPM-E Remove RPM-UVH Upgrade Installation
--nodeps Force installation--test test installation

Linux basic knowledge "turn"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.