Some of the frequently used commands in Linux
1. LS list: Displays all the files in the current folder
Ls-a: Show All Files
Ls-l: Display in detail
You can: Ls-la/-al/-a-l/-l-a in these ways, the meaning is: Show all the file details
2. Man: Search man manual for help information
More common ways:
Man 1 ls:1 means the query is a Linux command, here is the use of the query ls command
Man 2 xx:2 indicates that the query is a Linux API
Man 3 Xx:3 means C library function is queried (e.g. Man 3 strlen)
3. CD change directory, used to switch directories
CD/: Indicates to the root directory to go
Cd.. : Returns to the top level directory
Cd. : In the current directory (we can use LS-A to see if there is a. And.. These two folders)
CD-: Go to the previous directory (that is, from which directory you are jumping to the current directory, go back to that directory, note and CD.) There is a difference.)
CD ~: Go to the current user's host directory
There are some other symbols that mean:
$: Command-line prompt (for normal users)
#: Command line prompt for root user
*: Universal match (this symbol is useful, for example, if you want to delete many files with similar file names (abc.c abt.c abrt.cpp abr.tx) You just need to write RM ab* on it)
4. MV (move) moves files between directories or modifies file names (that is, renaming files)
Usage: Pathname of pathname destination folder for MV source files
Example: mv/mnt/hgfs/winshare/abc.txt/root/abc/(move file)
MV Abc.txt ab.txt (modify file name)
5. CP (copy) copy files/folders can also modify the file name
usage: CP (-R copy folder-F forced Copy ) source file pathname destination file pathname
Example: Cp-f/mnt/hgfs/winshare/abc.txt/root/abc/(forcing the Abc.txt file to be copied into the ABC folder)
cp-rf/mnt/hgfs/winshare/root/abc/(forcing the Winshare folder to be copied into the ABC folder)
6. RM (remove) Remove, delete files, folders
Usage: RM (-R Delete folder-F forced delete) file pathname
Example: Rm-rf/mnt/hgfs/winshare (Force delete folder Winshare)
Rm/mnt/hgfs/winshare/abc.txt (delete file abc.txt)
Note: The file is opened on the other side (it is actually loaded into memory), the file is deleted on this side (on the hard disk), so Linux will not error. Because you deleted the copy of the hard disk, the memory is not deleted, and when you last saved the file, the file was saved to the hard drive.
7. ln connection file, actually the connection here and the shortcut in Windows is much like
Usage: ln-s source file name symbol connection file name (soft connection, has a master-slave relationship, delete the main file, you will be connected from another link is error, and Windows shortcut is similar)
ln source file name symbol connection file name (hard connection, no master-slave relationship, equivalent to two files, but in essence, there is only one file on the hard disk, and when you delete one of the files, it does not prevent the access of the other link, only when all the links are deleted, the file is really deleted from the hard disk)
Example: Ln-s B.C BB.C Here B.C is the source file, BB.C is a soft connection file
Here's a look at the symbols for the different files:
L: Connection File
-: Normal file
D: Folder
S:socket file
P: Piping file (pipe)
8. Touch Create an empty file (note not a folder)
Usage: Touch pathname
Example: Touch helloworld.cpp
Touch/mnt/hgfs/winshare/hello.c
9. mkdir (make directory) Create folder
Usage: mkdir folder name
Mkdir-p folder name: Creating a cascading folder
Example: mkdir Mydir
Mkdir-p MYDIR/P1/P2/P3/P4 This allows you to create a cascading folder that contains p2,p2 in the Mydir folder containing P3 included in the p1,p1 ....
PWD (print work directory) prints working directories, prints the current absolute path
Usage: pwd
For example, if you are on/usr/local/bin and you enter PWD, then it will show:/usr/local/bin
Cat Displays the contents of the file directly at the command line, suitable for short files, and can also be used for input (to files)
Usage: Cat
Apt-get Install and Apt-get install (the program for installing and uninstalling files online)
This is the Ubuntu system installation software commands, such as you want to install g++, then you only need apt-get install g++, you can set up g++
RmDir (remove directory) removal, delete folder (must be empty folder, not empty deleted, so this command is more chicken, so, we generally use RM command)
Usage: rmdir pathname
Commands that are commonly used in Linux