Viewing Directory Information
Directory Listing Command
When you open the terminal, the first command you may need is ls. This command allows you to quickly view the files and folders in the current directory. Its syntax is quite simple:
ls [-alrtAFR] [name...]
Parameter explanation:
-a: Display all files and directories, including hidden files.-d: List only the directory itself, rather than the files inside it.-l: Display file information in detailed list format.-r: Display files in reverse order.-t: Sort by modification time.-A: Similar to `-a`, but does not display `.` and `..`.-F: Add a character after the filename to indicate the file type.-R: Recursively display the contents of all subdirectories.
Example:
ls -l
Directory Switching Command
The cd command allows you to move between directories:
Parameter explanation:
dirName: The path of the target directory.~: Jump to the user's home directory.../..: Move up two directory levels.
Example:
Current Path Display Command
Using the pwd command, you can quickly know the path of the current directory:
Example output:
Viewing System Information
System Information Command
To find out the type of system you are using, you can use the uname command:
Example output:
Screen Clearing Command
If your terminal interface is too cluttered, the clear command can help you clear the screen and start fresh:
File Content Display Command
To view the contents of a file, use the cat command:
Parameter explanation:
file: The file whose contents are to be displayed.
Example:
Example output:
User and File Operations
Command for Switching User Identity
If you need to execute a command as another user, you can use sudo:
Example:
Copying, Moving, Creating, and Deleting Files
To copy, move, create, and delete files or directories, use the cp, mv, mkdir, touch, rm, and rmdir commands respectively. These basic commands are ones every Linux user should master.
Command for Displaying Network Configuration Information
Network configuration is an important part of system administration. The ifconfig command can help you view and configure network interfaces:
Restart and Shutdown Commands
When managing a system, you may need to restart or shut down the computer. The reboot and poweroff commands can help you complete these operations easily.