Linux Command Line notes (1), commandline
Yunduan CUI
Graphical user interfaces make easy tasks easy, while command line interfaces make difficult tasks possible
Part 1 learning Shell1. what is Shell?
Shell is a program for users to communicate with the operating system. It reads users' keyboard input and submits it to the operating system to execute corresponding commands. All linux systems support a shell called bash. Its full name is "Bourne Again SHell", and bash's predecessor is sh written by Steve Bourne.
When we use Shell, we actually need another program named terminal emulator to interact with shell, which is a common program called terminal. (You can select different shells for the terminal)
2. Cruise
Cruise linux file system, common commands:
* Ls: displays the files in the current working directory.
* Cd: change the working directory
* Pwd: displays the name of the current working directory.
Linux uses a shuide-based file system. Unlike windows, which regards every disk as an independent file system, linux always maintains a file system.
When using the cd command, cd directly returns the default directory, cd ~ User_name returns the user's default directory, and cd-returns the previous directory. In addition, it indicates the current directory and... indicates the parent directory.
By default, hidden files are not displayed when the ls command is used.
3. Explore files
With more tips of ls, ls supports displaying the content of a specified folder, and also supports displaying the content of two folders. Use ls-l to display the long format of the file. -T can sort files according to the change time. Other useful options:
*-F special note/after the folder name-r reverse display in the alphabet-S sort by file size-t sort by change time
About the long format of a file
The first column is the first letter of the file access permission: -represents regular file d represents folder l represents the permissions of the file owner for the next three letters of the connected file, and the next three letters for the same group members, the last three permissions are for everyone. r indicates reading w indicates writing x indicates executing the second column to indicate the number of files (for folders, the file is naturally 1) the third column indicates the owner. The fourth column indicates the group. The fifth column indicates the file size (bytes). The sixth column is the creation date. The seventh column is the file name.
Determine the file type
Use the file command to determine the file type
Read File Content
Use the less command to read the file content. The operation after entering the content is as follows:
Page Up/B roll back one Page
Page Down/space to roll back one Page
Roll up/down arrows forward/back a row
G move to the end of the file
1 G/g move to the file header
/[Characters] Forward to [characters]
N find the next search Target
H Show Help
Q exit
The predecessor of less is more. The reason why the opposite name is used is becauseLess is more
Introduction to file systems
| Directory Name |
Introduction |
| / |
Root directory |
| /Bin |
Contains binaries program for storing the system |
| /Boot |
Startup information, initialized RAM and hard disk images, and Linux Kernel |
| /Dev |
Store drivers |
| /Etc |
Stores system, program configuration files, and shell scripts. |
| /Home |
The folder used by the user. Generally, the user only needs to work in this file. |
| /Lib |
The library files used by all programs (a bit like windows DLL files) are here |
| /Lost + found |
This folder is only available in the formatted linux file system and can be used to restore partial files. Unless something bad happens, it is generally empty. |
| /Mnt |
It only appears on the old linux and is used to store the drive of the mobile device. |
| /Opt |
The optional programs are stored here, which generally stores the programs installed later by the user. |
| /Proc |
This is a special folder. It is a virtual folder, which is equivalent to a peep hole to the Linux kernel. You can see from the files in it how the kernel looks at the current PC's |
| /Root |
Root Account directory |
| /Sbin |
Used by super users, including core system programs |
| /Tmp |
Temporary File Storage |
| /Usr |
Generally, the folder is the largest and contains all programs and files used by common users. |
| /Usr/bin |
Stores installed linux executable files |
| /Usr/lib |
Library files used by the user's installation files |
| /Usr/local |
The programs installed by the user are usually installed here from the files compiled by the source code. |
| /Usr/sbin |
Store the installed administrator Program |
| /Usr/share |
Store files shared by programs in/usr/share |
| /Usr/share/doc |
Generally, some packages that are installed contain documents. Put them here. |
| /Var |
It is also used to store frequently changed files, such as user emails. |
| /Var/log |
Store log files |
Symbolic Links
A unique file form in Linux that can be connected to other files. It is also called soft link. It allows us to update the version of some components, because link can be used as a variable name.
4. Operation files and directories