Note: These are the most basic linux commands, but they are also the most important. I have seen many posts that ignore this point and I have published it here, there are many small details and easy-to-make small mistakes in liunx. Some of my posts will prompt that I hope you can learn well.
Use pwd to display the current path
[Root @ 0425 ~] #/Bin/
[Root @ 0425 ~] #/Usr/bin/
[Root @ 0425 ~] #/Usr/local/bin/command directory that can be executed by common users
[Root @ 0425 ~] #/Sbin/
[Root @ 0425 ~] #/Usr/sbin/
[Root @ 0425 ~] #/Usr/local/sbin/command directory that the administrator can execute
[Root @ 0425 ~] #/Root/Administrator's home
[Root @ 0425 ~] #/Home Directory of common users
[Root @ 0425 ~] #/Etc/configuration file directory
[Root @ 0425 ~] #/Var/server data directory
[Root @ 0425 ~] #/Usr/application directory
[Root @ 0425 ~] #/Tmp/temporary file directories cannot be deleted. The most obvious reason is that the graphic interface cannot be opened)
[Root @ 0425 ~] #/Dev/block device directories, such as USB flash drives, do not refer to hardware)
[Root @ 0425 ~] #/Boot program directory (kernel Startup File boot Program)
[Root @ 0425 ~] #/Lib/
[Root @ 0425 ~] #/Usr/lib
[Root @ 0425 ~] #/Usr/local/lib module for storing library files and system files
[Root @ 0425 ~] #/Sys/pseudo File System
[Root @ 0425 ~] #/Proc/pseudo File System Kernel Parameter Process Information)
[Root @ 0425 ~] #/Mnt/other mount points
[Root @ 0425 ~] #/Opt/third-party software catalog
[Root @ 0425 ~] #/Net/autofs Automatic File System)
[Root @ 0425 ~] #/Misc/autofs Automatic File System)
[Root @ 0425 ~] #/Home directory of the tftpboot/tftp Server
[Root @ 0425 ~] #/Selinux
[Root @ 0425 ~] #/Media Directory
[Root @ 0425 ~] #/Srv/server data directory
[Root @ 0425 ~] #/Lost + found/This directory is used to save temporary files. For example, if a temporary file is shut down illegally, the file system will be restored)
# The absolute path and relative path are shown in the preceding figure/
[Root @ 0425 user14] # cd.../... go back to the upper layer of your upper layer.
[Root @ 0425 user14] # cd ~ Quick home directory method
[Root @ 0425 user14] # cd. Refresh the current directory
[Root @ 0425 ~] # Cd-switch between two directories to return the last working directory
File Type:
-Common files
D directory file
L The shortcut for connecting to file wi is similar
Block B device files, such as USB flash drives
C character file Terminal
Direct communication between file processes and processes in the p Pipeline
S sets of character files are also the IP address and address of the communication process.
Command for viewing files:
Show all files: ls-a all files starting with. are hidden files
Show all files except... ls-
Show file DETAILS ls-l
Show more detailed ls-lh File Size
The ls-ld/etc directory is displayed when you view the directory.
View directories sorted by time ls-lt if the reverse display ls-lr
Recursive ls-R display
HELP command:
Ls-help
Info ls
Type ls
Man ls [] indicates optional
1 Introduction NAME
2 usage: SYNOPSIS
3 parameter DESCRIPTION
.. Reporting bug reporting bugs mailbox is <bug-coreutils@gnu.org>
Man 1 USER command
Man 2 many developers are calling the system)
Man 3 Library call)
Man 4 special files
Man 5 configuration file
Man 6 Game Description
Man 7 Miscellaneous
Man 8 system commands are only used by administrators)
Man 9 kernel reference
Man-f passwd query keywords in those chapters)
Man-k passwd fuzzy query)
Makewhatis maintenance man can also be said to be updated man)
Passwd, even if a command has a file, can be viewed by man 1 passwd to avoid sending such a task)
Command for viewing file content:
[Root @ 0425 ~] # More/etc/space indicates an interface. The interface must go down.
* **/Etc/: directory ***
[Root @ 0425 ~] # Less/etc/passwd can be viewed
Beginning: head
[Root @ 0425 ~] # View the specified number of rows in head/etc/passwd
[Root @ 0425 ~] # Head-n 50/etc/passwd
[Root @ 0425 ~] # Head-50/etc/passwd view the first 50 rows
Last: tail
[Root @ 0425 ~] # Tail-n 50/etc/passwd
[Root @ 0425 ~] # Tail-50/etc/passwd view the last 50 lines of content
[Root @ 0425 ~] # Tail-f/var/log/messages dynamic log File monitoring
[Root @ 0425 ~] # Service gpm restart mouse
-------
[Root @ 0425 ~] # Cat/etc/passwd display from scratch
[Root @ 0425 ~] # Cat-n/etc/show all row numbers of the row number
[Root @ 0425 ~] # Cat-B/etc/display valid rows with row numbers and spaces do not show only valid rows)
| The result of using the previous command output as the input of the next command is equivalent to double processing !)
-------------------------------------------
Create a file
[Root @ 0425 ~] # Touch 1 create 1 file
[Root @ 0425 ~] # Touch abc {1 .. 10} create 10 abc files
[Root @ 0425 ~] # Touch a0000b..c000000001..50000.txt create ab1 ab2 ab3 ab4 AB 5
Ac1 ac2 ac3 ac4 ac5
Create directory
[Root @ 0425 ~] # Mkdir
[Root @ 0425 ~] # Mkdir/etc/aa
[Root @ 0425 ~] # Mkdir-p xx/aa the directory does not have the xx folder. You can directly add-p to create xx and then create aa
[Root @ 0425 ~] # Mkdir-p-v xx/aa shows the creation process
Recursive query means that if I ask my dad why I don't look like you, Dad says, when I ask your grandfather
I asked my dad why I was not as long as you did. Dad said that he always asked your grandfather to go.
----------------------------------------------
Cp Copy command
Cp original address target address
[Root @ 0425 ~] # Cp/root/xx/etc/
[Root @ 0425 ~] # Change the file name xx to vv during cp/root/xx/etc/vv copying.
Cp directory
[Root @ 0425 ~] # Cp-r/etc // root/copy a directory and add-r
----------------------
Mobile file clipping)
[Root @ 0425 ~] # Mv/etc/tt.txt/tmp/cut the tt.txt under/etc/to/tmp
[Root @ 0425 ~] # Mv/etc/tt.txt/tmp/aa.txt move the file and change its name
[Root @ 0425 ~] # Name of mv tt.txt aa.txt in the local directory
----------------------------
Delete directory
Rmdir can only delete empty directory files or
[Root @ 0425 ~] # Rmdir/etc/aa/Delete the empty directory aa
Rm
[Root @ 0425 ~] # Rm/etc/aa/ask if you want to delete the Directory
[Roo @ 0425 ~] # Rm-f/etc/aa/directly delete a directory without asking
[Root @ 0425 ~] # Delete files in the rm-rf/etc/aa/directory together
* Wildcard
[Root @ 0425 ~] # Rm-rf *. txt batch Delete txt files
[Root @ 0425 ~] # Rm-rf AB * Delete all files in front of AB
Do not delete the/file to directly install the system.
[Root @ 0425 ~] # Rm-rf/a.txt do not add spaces or spaces, that is, delete the.txt file in the/directory.
Tree
View the Created directory
[Root @ 0425 ca] # tree/aa/
/Aa/
| -- Ba
| -- Ca
| -- Test.txt
| -- Test.txt ~
| '-- Test1.txt
| '-- Cb
'-- Bc
'-- Cc
'-- Test.txt
Create the following directory structure (one command is complete) (and verify)
/Aa
/\
Ba/bc/
/\\
Ca/cb/cc/
Mkdir-p/aa/ba/c {a, B}/aa/bc/cc
[Root @ 0425/] # mkdir-p-v aa/ba/c {a .. B}/aa/bc/cc/
Mkdir: created directory 'A'
Mkdir: created directory 'aa/Ba'
Mkdir: created directory 'aa/ba/ca'
Mkdir: created directory 'aa/ba/cb'
Mkdir: created directory 'aa/bc'
Mkdir: created directory 'aa/bc/CC'
. If you copy the same file to the same directory twice, the overwriting prompt is not displayed.
[Root @ 0425 ca] # \ cp/root/install. log/etc/Add \
[Root @ localhost ~] #/Bin/cp/root/install. log/etc/directly use cp to copy the alias without executing it
Unalias cp
Cp/root/install. log/cancel alias copying
This article is from the "history_xcy" blog, please be sure to keep this http://historys.blog.51cto.com/7903899/1296606