Linux directory structure and command collection

Source: Internet
Author: User

First speaking Linux
First, installation
VMware virtual Machines
CentOS 7...iso
Virtual machine New Linux-centos virtual machine
Adding ISO discs to the virtual machine CD drive
Start the installation
* Minimum (NO)
* Minimum Network Service (recommended)
* with Desktop
* Select Auto Partition

Second, the division
====================================================================
Must be partitioned:
/root
Swap disk virtual memory, data interchange partition
Twice times the memory, not more than 2G
Recommended partitioning
/boot boot file partition, 500M

Third, Linux
===================================================================
* Kernel kernal.com
* Shell Shell
Bash Red Hat Series
Other

1. LS directory list
===========================================================
-A--all All files

-L long format-file D directory l soft Connect
------------------------------
rw-r--r--Permissions
Owner permission group permissions for others
U g o
R-read Read
W-write Write
X-execute execution
------------------------------
Number of connections
------------------------------
Owning group
------------------------------
File size
------------------------------
Last Modified Time
------------------------------

-D View directory properties instead of listing directories

-H User-friendly display Kb Mb Gb

-I. ID column
ll ls-ld abbreviation

2. mkdir Create Directory
===========================================================
-p recursively create multi-level catalogs

3. CD can set a directory to the new current directory CD directory path
===========================================================

PWD can be used to observe the location of the current directory/home/tarena
===========================================================

4. RmDir Delete Empty directory
===========================================================

5. RM Delete files or directories
===========================================================
-R Delete Directory
-F no need to confirm
, CP replication
===========================================================
-R Copy Directory
-P Hold file properties

7. MV Move or rename
===========================================================

8. Touch Create File
===========================================================
File Permissions rw-rw-r--
U g o
R 4 100
W 2 010
X 1 001
111
9. Cat View Files
===========================================================
-N Line number
10. TAC Reverse View File
===========================================================
11, more paging
===========================================================
More file spaces, F page, enter, single line Q, exit


12. Less Paging
===========================================================
Support PAGE UP PgUp, Upper arrow up line
/Search Keywords
N Next, search for the next keyword
Q, exit

13, Ln
===========================================================
-S Soft link
ls file File_link
Ls-s file File_link_soft
*) Soft Connection, equivalent to shortcut
*) hard link, is a copy of the file,
Two files synchronized modify, delete one, another still exists, two files have the same ID
13. chmod Modify File directory permissions
===========================================================
R 4
W 2
X 1
+ - =
chmod u+x,g-rw,o=r File
chmod 755 File
File R Read W write X Execute
Directory r List W Create, delete internal file X enter
14, Chown Modify the owner
===========================================================
Chown User File

15. CHGRP Modify the owning group
===========================================================
CHGRP Group File

16, find
===========================================================
Find/etc-name init*-a-type F
- Name search file name, wildcard *,?
-iname Ignore case
-size Search by file size
+ blocks, greater than ...-number of blocks, less than ...
One Piece equals 512 bytes
-size +20800 is greater than 20800*512 bytes
-size 20800 equals 20800*512 bytes
-user
-group
Find by owner, owning group
Find- User root
-amin
Access minutes, searching for
-cmin
Change by Access time, property changes
-mmin
Modify, Content modification
-amin-60 within 60 Minutes /p>

-type F, D, l
-A and
-O or
-exec-ok
Execute an action command directly on a lookup result
...-exec ls-l {} \;
...-ok ls-l {} \;
User Confirmation required
17. Locate find files based on file library
===========================================================

18, UpdateDB and new file library
===========================================================
19which Command Lookup, aliases
===========================================================
20, Whereis command lookup, there is a document location
===========================================================
21. grep File Content Lookup
===========================================================
grep root/etc/passwd
Ls-l/etc |grep ^d
-I ignores case
-V exclude ...-v ^#
Help documentation for the man command or configuration file
Kernel command, cannot use man document
===========================================================
Mans LS
Mans Services
Page UP and down
\ Find n Next
Q exit

22. Simple information of Whatis command
===========================================================
Whatis ls

23. Apropos configuration file information
===========================================================
Apropos Services Apropos passwd
24. Command--help
===========================================================
Info Display command Help documentation
Help helps command internal command assist
25, Useradd Useradd wanght
26, passwd
passwd Wanght
27. Who
View logged in user
28, uptime Linux continuous Running time
28, W system running time, number of users, load situation
User's idle time, accumulated CPU time, single CPU time, what command was run
===========================================================

29. Gzip
===========================================================
Gzip file compression, cannot compress directory
gzip-d file.gz Decompression

===========================================================
30, Gunzip Decompression

30. Tar tar-zcf file.tar dir
Compressed directory
===========================================================
TAR-ZXVF file.tar.gz
Unzip Directory
-C Create a packaged file
-V Show More information
-F Specify File name
-Z Package also compresses GZ
-j Packing and compressing bzip2
-X Unpack the package
-Z Decompression
31. zip
===========================================================
Zip file.zip file
Zip-r Dir.zip dir
Unzip unzip File.zip
===========================================================

bzip2 bzip2 File
===========================================================
-K Preserve Source files
BUNZIP2 bzip2 file.bz2
===========================================================
-K Preserving Compressed files
32. Write
===========================================================
Write username
Message ... message ...
33, Wall sent to all users
===========================================================
Write to All
Wall message ...
34. Ping
===========================================================
Ping-c 3 3 times




35, Ifconfig ifconfig network card 192.168.xx.xx
===========================================================
Set IP
IP addr Add 192.168.0.193/24 dev Wlan0


36. Mail to the specified user
===========================================================
Mail User Ctrl + D save Send
Mail
View Mail
& 1 View serial number & H List & D1 Delete sequence number & Q exit
36. Last List User login information
===========================================================
37, Lastlog
===========================================================
List last login information for all users
-U 502 Specify User ID
38. Path between traceroute packets to host
===========================================================
Traceroute www.163.com
Traceroute 192.168.xx.xxx
Traceroute code.tarena.com.cn

39, netstat Display network information
===========================================================
-T TCP
-U UTP
-L Monitoring
-R Routing
-N IP, Port
-tlun the port that the native listens to
-an all network connections for this machine
-rn Native routing table
Commonly used three parameters

40. Setup Network
===========================================================

41. Service Network Restart Restart
===========================================================

42, Mount Mount
===========================================================
-T file system disc: iso9660 U-Disk: ntfs-3g FAT32
Mount-t Iso9660/dev/cdrom/mnt/cdrom
43, umount umount device
========================================== =================
Umount/dev/cdrom
Umount/dev/sdb
44, shutdown shutdown
================================== =========================
-H Specify Time-H now or-H 20:00
-R Restart-R now or-R 20:00
-C Cancel subscription shutdown command

Halt Poweroff Init 0 shutdown

===========================================================
Reboot init 6 restart
=========================== ===============================
45, System run level
===========================================================
Init
0 shutdown
1 single User (safe mode)
2 not fully multiuser, no NFS service
3 full multiuser
4 unassigned
5 graphical interface
6 Restart
46, RunLevel view level
= ==========================================================
47, Logout logout (important)
============================= ==============================
48, Vim mode
===========================================================
1. Command mode 2. Insert mode I a o 3. Edit mode:

2, insert mode: ESC exit
A word specifier insert
A line end insert
I word match either insert
I start insert
o Insert new line above
O Insert new Line
Edit mode:
Colon entry
: Set Nu Display line number
: Set Nonu cancel line number
GG to first line
G to last line
NG to nth row
: N to Nth row
$ move to end of line
0 move to beginning

x Delete character
NX Delete back n characters
DD Delete line
NDD delete n rows
DG deletes current line to end of file
D Delete current character to line end
: n1,n2d N1 line to N2 row Delete

yy copy current line
Nyy copy current row down n rows
DD Cut Current line
NDD cut current line down n lines

p, p paste above or below the current line

R overrides a single character
R persistent overwrite character, ESC exits

U fallback
Ctrl+r Redo

/search for the specified string
N Next

:%s/aaaa/bbbb/g do not ask
:%S/AAAA/BBBB/C Ask for confirmation
Full-text replacement, AAAA replaced with BBBB

: n1,n2s/aaaa/bbbb/g do not ask
: N1,N2S/AAAA/BBBB/C Ask for confirmation
Specify line-in-range substitution

: Set IC is case insensitive
: Set Noic Case sensitive

: W Save
: w filename Save As
: Wq Save and exit
ZZ Save and exit, shortcut
: Q
: q! Do not save direct exit
: wq! Forcibly save and exit the read-only file (owner and root are available)

: R \AA\BB
Import bb File contents
:! command
Do not exit Vim Execution System command

: R! command
Import command Execution results

: Map custom shortcut keys
: Map [CTRL+VP] i#<esc> ctrl+p Add #
: Map [CTRL+VB] 0x<esc> ctrl+b Cancel #

: n1,n2s/^/#/g Header Add #
: n1,n2s/^#//g Header Removal #
: n1,n2s/^/\/\//g Header Add//

: AB omg Oh my god!
Define abbreviations, replace with full text
. VIMRC
User Directory Vim command configuration file,
Can add shortcut keys, abbreviation configuration, etc.

49, rpm
===========================================================
-I Installation
-V Installation Information
-H installation Process
-nodeps does not detect dependencies
-U Upgrade
-e Uninstall, write only the package name
-Q query is installed, write-only package name
-qa Query All
-qi Querying software Information
-QIP query does not install package, write package full name
-QL File Installation Location
-QLP where the package files will be installed without installation
-QF query which package a file belongs to
-QR Dependency of query packets
-QRP not installed packages that are dependent on the query
-V Checksum, write-only package name

Check if any files have been modified after the software installation
8 Information
S File Size
Type of M file, or permissions
5 MD5 Checksum value
D device in and out of the code is changed
L file path
U file Owner
G belongs to Group
T Modify Time

File type
C Configuration File
D General Documents
G Ghost file, should not belong to the package
L Authorization Documents
R Description File Readme
Rpm2cpio
rpm2cpio/mnt/cdrom/packages/coreutils-8.4-19.e16.i686.rpm | Cpio-idv. /bin/ls
Extracts a file from the specified package
Www.rpmfind.net
Component Information Query
httpd-2.2.15-15.e16.centos.1.i686.rpm
HTTPD Package Name
2.2.15 version
15 release Times
E16.centos the right Linux platform
i686 the right hardware platform
Rpm

50. Yum
===========================================================
On-line management of RPM packages, automatic online download of dependent packages and components

Yum list queries all available packages
Yum Search Package Name
Yum-y Install package Name
YUM-Y Update package name does not specify a package name, the kernel is upgraded, causing the system to crash
Yum-y Remove Package name try not to perform uninstallation, otherwise a useful dependency package will be removed
Yum Grouplist
Yum Groupinstall
Yum Groupremove

Disc Yum Source
Renaming other files in the/etc/yum.repos.d/directory, keeping only media
Vim Modify media file, change enabled=1

Linux directory structure and command collection

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.