Linux Learning Notes Linux directory Architecture _unix Linux
Last Update:2017-01-18
Source: Internet
Author: User
Linux Directory Architecture
/root directory
/bin commonly used commands binary file's catalogue
/boot store files that must be read when the system is started, including the core (kernel)
/boot/grub/menu.lst Grub Settings
/boot/vmlinuz kernel
RAM Disk required for/BOOT/INITRD core decompression
/dev System Peripheral Equipment
/ETC System Related setup file
/etc/dir_colors Set Color
/etc/hostname set the user's node name
/etc/networking only yes indicates network presence
/etc/host.conf file describes how the user's system queries the section roll name
/etc/hosts set the user's own IP and name of the corresponding table
/etc/hosts.allow settings allow use of inetd machines
/etc/hosts.deny settings do not allow use of inetd machines
/ETC/HOSTS.EQUIV set remote machine without password
/etc/inetd.conf set up the System network daemon process inetd configuration
/etc/gateways Set Router
/etc/protocols set System-supported protocols
/etc/named.boot Configure the computer as the name server configuration file
/etc/sysconfig/network-scripts/ifcfg-eth0 Set IP
/etc/resolv.conf Set DNS
/etc/x11 X Window configuration file, xorg.conf or xf86config these two x Server settings
/etc/fstab record the file system on which to mount
/etc/inittab sets the system to what runlevel the init process will set up when the system starts
/etc/issue record the information displayed before the user logs in
/etc/group set the user's group name and related information
/ETC/PASSWD account Information
/etc/shadow Password Information
/etc/sudoers can sudo command configuration file
/etc/securetty to set which terminals can log root
/etc/login.defs The default configuration for all users when they log on
/etc/exports to set the NFS system
/etc/init.d/all of the service's preset script is placed here, such as to activate or close
/etc/xinetd.d/This is what is called the "Super Daemon Management" set of services.
/etc/modprobe.conf Kernel module Additional parameter setting
/etc/syslog.conf Log Settings file
/home User Home Directory
function libraries that the/lib system will use
Related modules of/lib/modules kernel
/VAR/LIB/RPM RPM Kit Installation Office
When the/lost+found system is wrong, some missing fragments are placed in this catalogue.
Mount point of/mnt Peripherals
/media and/mnt are similar
/OPT Host additional installed software
/proc Virtual directory, is the memory of the map
/proc/version kernel version
/proc/sys/kernel System kernel function
/root system Administrator's home directory
Instructions to be executed by the/sbin system administrator
/srv Some of the services that need to be taken into account,
/TMP general user or where the program being executed is temporarily placed
/usr the largest directory, save applications and files
/usr/x11r6:x-window Directory
/usr/src:linux Source Code
/usr/include: System Header File
/usr/openwin Store Sun's Openwin
/usr/man Online User Manual
/usr/bin the user can perform the binary file
/usr/local/bin the user can perform the binary file
function libraries that the/USR/LIB system will use
function libraries that the/USR/LOCAL/LIB system will use
Instructions to be executed by the/usr/sbin system administrator
Instructions to be executed by the/usr/local/sbin system administrator
/var log File
/var/log/secure record access to data files, such as POP3, SSH, Telnet, FTP, etc. are recorded in this file.
/var/log/wtmp Record login information, last
/var/log/messages Almost system error messages
/var/log/boot.log or when it's time to start a service, the activation or shutdown is displayed.
User records for/var/log/maillog access or coming (SendMail and POP3)
/var/log/cron Records 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 services.
Some of the most common basic commands:
Uname-a View Kernel version
Ls-al Display properties for all files
PWD Show current path
CD-Back to previous directory CD ~ Return to home directory
Date s set time, dates
CAL Displays calendar Cal 2006
BC Computing Apparatus
Man & Info Help manual
Locale Display the current font locale-a all available fonts/etc/sysconfig/i18n settings file
lang=en Use English fonts
Sync writes data to the hard disk synchronously
Shutdonw-h now & half & Poweroff shutdown
Reboot reboot
StartX & Init 5 into the graphics interface
/work & Work Find document content up and down
Chgrp Change file group CHGRP testing Install.log
Chown Change the person chown root:root Install.log
chmod change attribute chmod 777 Install.log read=4 write=2
CP replication CP filename
RM Delete file rm-rf filename Force Delete file
RmDir Delete Folder
MV Mobile MV 123.txt 222.txt Rename
mkdir Create a folder
Touch Create file Update current time
Cat starts with the first line showing cat |more pagination
NL add line number to front of content
More & less Side flip
Head-n filename shows nth row content
Tail-n filename shows the contents of the following n lines
OD Display non-pure documents
DF-H Display partition space
Du displays the size of the directory or file
Fdisk partition settings fdisk-l/dev/hda show hard disk partition status
MKFS establish various file systems Mkfs-t EXT3/DEV/RAM15
FSCK check and repair Linux files
ln hard link ln-s software link
Whereis Lookup Command
Locate find
Find finding/-name "***.***"
Which viewing tool
WHOAMI Display Current User
Gcc-v View GCC version
chattr +i filename Prohibit deletion of chattr-i filename cancellation ban
Lsattr Show hidden file properties
UpdateDB Update Repository
MKE2FS format mkfs-t ext3
DD IF=/ETC/PASSWD Of=/tmp/passwd.bak Backup
Mount lists all partitions of the system
MOUNT-T Iso9660/dev/cdrom/mnt/cdrom Mount CD
MOUNT-T Vfat/dev/fd0/mnt/floppy mounted 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 partitions
Linux-ntfs project:http://linux-ntfs.sourceforge.net/
Umount/mnt/hda3 Unloading load
Ifconfig display or set up network devices
Service Network restart Reboot network card
Ifdown eth0 off the NIC
Ifup eth0 Open Network card
Clear Screen
History history!55 Execute 55th instruction
Stty Set Terminal stty-a
FDISK/MBR Delete Grub
At a single working schedule
Crontab routine command [e] edit, [l] show, [R] Delete task
& Background Running program TAR-ZXVF 123.tar.gz &---------> Background run
Jobs Watch Background Paused program Jobs-l
FG Transfer Background program to the foreground FG N------>n is a number that can be specified for that program
BG lets work run in the background
Kill End Process Kill-9 PID [9] Force end, [15] ends normally, [l] lists available kill signals
PS aux view background program
Top View Daemon top-d 2 Update once every two seconds top-d 2-p10604 watch a PID
Top-b-N 2 >/tmp/top.txt-----> Make top information 2 times and then output the results to/tmp/top.txt
Pstree the program in a tree diagram [A] connects in ASCII, lists the PID,
List account number
Killall to delete a service killall-9 httpd
Free display memory status free-m--------> show in M
Uptime shows current system boot time
Netstat Display network status NETSTAT-TULNP------> Find out the current system has been listening to the link and its PID
DMESG display boot Information demsg | More
Nice set Priority Nice-n-5 VI &-----> with root to a nice plant-5, used to perform VI
Renice adjustment already exists priority
RunLevel shows the current runlevel
Depmod analysis of dependencies of loading modules
LSMOD displays the modules that have been loaded into the system
Modinfo display information for kernel modules
Insmod Loading Module
Modprobe Automatic Process Loading module
Rmmod Delete Module
Chkconfig Check, set up the system of various services Chkconfig--list-----> List Service Status
NTSYSV set up various services for the system
Cpio Backup Files
Compression command:
*. Z Compress program compressed file;
*.BZ2 bzip2 Program compressed file;
*.GZ gzip program compressed file;
The *.tar of the TAR program is not compressed;
*.tar.gz the TAR program, where it has been compressed by gzip
Compress filename Compressed file plus [d] decompression uncompress
gzip filename compression plus [d] Extract zcat 123.gz View compressed file contents
bzip2-z filename compression plus [d] Extract bzcat filename.bz2 View compressed file contents
TAR-CVF/HOME/123.TAR/ETC package, no compression
TAR-XVF 123.tar untie Package
Tar-zxvf/home/123.tar.gz with gzip decompression
TAR-JXVF/HOME/123.TAR.BZ2 to bzip2 Decompression
tar-ztvf/tmp/etc.tar.gz View tar Content
Cpio-covb > [File|device] Part
Cpio-icduv < [file|device] Restore
VI General Usage
General mode edit mode instruction mode
H Left A,i,r,o,a,i,r,o:w Save
J Enter edit mode: w! Force Save
K on DD Delete cursor current line: q! Do not save leave
L Right NDD delete n line: wq! Leave after saving
0 move to the beginning of YY copy current line: e! Restore Original file
$ move To line end Nyy copy n rows: w filename Save As
H screen Top p,p paste: Set nu setting line number
M-Screen Central U undo: Set Nonu cancel line number
L screen at the bottom [ctrl]+r Redo last action ZZ save leave
The last line of the G file [ctrl]+z pause exit: Set Nohlsearch permanently closes highlighting
/work Search: SP opens two documents at the same time
? work search up [ctrl]+w two document change
GG move to file first line: Nohlsearch temporarily turn off highlighting
Understanding Shell
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 to Path
echo $PATH Display path Path
Bash into subroutine
Name=yang Set Variable
unset name Cancel Variable
echo $name Display the contents of a variable
Myname= "$name its i" & Myname= ' $name its me ' single quotes $name lose variable content
ciw=/etc/sysconfig/network-scripts/set Path
ENV Lists all environment variables
echo $RANDOM show randomly generated numbers
Set setting shell
Ps1= ' [\u@\h \w \a #\#]\$ ' prompt character set
[Root@linux ~]# read [-pt] variable-----------reading variables for keyboard input
Parameters:
-P: The back side can receive the prompt character!
-T: The back can wait "seconds!" 』
Declare declaring shell variables
ULIMIT-A Display all restricted data
Ls/tmp/yang && echo "Exist" | | echo "not exist"
It means that when Ls/tmp/yang is done, if it is true, it performs the echo "exist", and if there is a problem, the echo "not exist" is executed.
echo $PATH | Cut-d ': '-F 5 to: Read the 5th paragraph as a separator
Export | Cut-c 10-20 reads the 10th to 20th byte content
Last | grep ' root ' searches for a line with root, plus [-v] Reverse Search
cat/etc/passwd | Sort order Display
cat/etc/passwd | WC shows "line, Word, number of bytes"
Formal representations
[Root@test root]# grep [-acinv] ' search string ' filename
The parameters say:
-A: binary files are searched in text file
-C: Calculate the number of ' search string '
-I: Ignores the difference in size, so the size is written in the same
-N: Enter the travel number
-V: Reverse selection, which shows the line without the ' search string ' content!
Grep-n ' The ' 123.txt searches the character-----------search for specific strings
Grep-n ' t[ea]st ' 123.txt search test or taste two characters---------use [] to search for collection characters
Grep-n ' [^g]oo ' 123.txt search for oo-----------not preceded by G [^]
Grep-n ' [0-9] ' 123.txt search has 0-9 digits
Grep-n ' ^the ' 123.txt search at the beginning of the line-----------
Grep-n ' ^[^a-za-z] ' 123.txt search does not begin with an English letter
Grep-n ' [a-z]$ ' 123.txt search ends with a-Z line----------end of line
Grep-n ' G.. d ' 123.txt search for the beginning G End D character----------any character.
Grep-n ' ooo* ' 123.txt search for at least two OO characters---------a duplicate character *
Sed text flow editor uses script commands to work with text files
AWD mode scanning and processing languages
NL 123.txt | Sed ' 2,5d ' deletes the contents of the second to the fifth line
Diff Comparison file differences
CMP compares two files for differences
Patch Patch files
PR format of the file to be printed
Account Management
/ETC/PASSWD System Account Information
/etc/shadow account password information through MD5 32-bit encryption
In front of the password bar, add "*" "!" Prohibit the use of an account
/etc/group System Group Information
/etc/gshadow
NEWGRP Change Landing Group
Useradd & AddUser Create a new user---------> Useradd-m test automatically create a user's login directory
Useradd-m-G pgroup Test---------> Specify owning Level
/etc/default/useradd Related Settings
/etc/login.defs Uid/gid the setting
passwd Change Password-----------> passwd test
Usermod Modify user Account
Userdel Delete account----------->userdel-r test
The shell [-l] used by CHSH to replace the login system displays the available shell; [-S] Modify your shell
CHFN change the information displayed by the finger command
Finger finds and displays user information
ID Displays the user ID-----------> ID Test
Groupadd Add a group
Groupmod and Usermod are similar
Groupdel Delete Group
Su test changes user Su-into root and uses the environment variables of root
sudo executes instructions in a different capacity.
Visudo Edit/etc/sudoers Join one line "Test all= (All)"
%wheel all = (all) users of all wheel groups in the system can use sudo
%wheel all = (all) Nopasswd:all Wheel group All users are not 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 (join before the instruction!)
PAM (pluggable authentication Modules, embedded modular Group)
Who & W Look who's online
Last recent landing of the host information
Lastlog recently logged in to read/var/log/lastlog
Talk Chat with other users
Write send message write test [ctrl]+d send
MESG Set Terminal Write permission MESG n prohibit 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 shows the space used by the disk with the limit Quota-guvs-----> show out the current quota limit of root values
Quota-vu Query
Quotacheck Check disk usage space and Limitations quotacheck-avug-----> to scan all partition in/etc/mtab containing quota support
[-m] forced scan
Quota must be independent of the partition, to have Quota.user and quota.group two files, add a sentence in/etc/fstab:
/dev/hda3/home ext3 Defaults,usrquota,grpquota 1 2
chmod quota* Setup completed, restart effective
Edquota edit users or groups of quota users, [g] groups,
Copy, [t] set grace period
Edquota-a Yang edquota-p yang-u-----> Replication
Quotaon Open disk space limit QUOTAON-AUVG--------> Activate all filesystem with quota
Quotaoff Turn off disk space limits quotaoff-a--------> shut down quota restrictions
Repquota-av the limit state of all quota filesystem in the search system
Quota from the beginning of the preparation of filesystem support to the whole set of the main step is probably:
1, set partition filesystem support quota parameters:
Since the quota must make the partition above filesystem support, generally speaking, the best support is EXT2/EXT3,
Other filesystem, I didn't try! The easiest way to activate filesystem support quota is to edit/etc/fstab,
Make ready to open the quota disk can support quota;
2, the establishment of quota record files:
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 the Quotacheck to scan.
3. Edit quota Limited Value data:
Again, use the Edquota to edit each user or group's available space.
4. Re-scan and activate quota:
After setting a good quota, the advice can be quotacheck again, and then quotaon to activate it!
Introduction to the boot process
1, loaded into the BIOS of the hard information, and obtain the first device generation;
2. Read the boot Loader (that is, Lilo, Grub, Spfdisk, and so on) for the first device's MBR;
3, load into the Kernel operating system core information, Kernel began to decompress, and try to drive all hardware devices;
4, Kernel execute the INIT program and obtain run-level information;
5, Init executed/etc/rc.d/rc.sysinit file case;
6, activate the core of the outer Die Group (/etc/modprobe.conf);
7, the Init performs the run-level each batch file (Scripts);
8, Init executed/etc/rc.d/rc.local file case;
9. Execute the/bin/login program and wait for the user to login;
10, login to start with the Shell to control the main machine.
In/etc/rc.d/rc3.d, the start starts with S, the closure begins with K, then the number represents the order of execution.
GRUB VGA settings
Color degree resolution 640x480 800x600 1024x768 1280x1024 bit
256 769 771 773 775 8 Bit
32768 784 787 790 793 bit
65536 785 788 791 794 bit
16.8M 786 789 792 795 bit
./configure check System information./configure--help | More help information
Make clean erase files left before
Make compilation
Make install Installation
RPM-Q-----> Query whether to install RPM-QL------> Query All directories of the suite
RPM-QI-----> Enquiry Kit RPM-QC[D]-----> Profile and Specification file
RPM-IVH----> Installation rpm-v--------> see if the kit has been altered
RPM-E------> Remove RPM-UVH-------> Upgrade Installation
--nodeps-----> Forcibly install--test-----> Test Installation