Basic Commands
Sure, please provide the text that you would like me to translate.
Here is an introduction to basic commands for operating a Linux server.
Most commands can be viewed with detailed explanations by adding the --help
parameter.
File System¶
File List¶
List all files and folders in the current directory.
- The first column starting with
drw
: represents the permission settings of the file (Todo) - The second column
13
: number of links - The third column
ubuntu
: user who owns the file - The fourth column
ubuntu
: group that owns the file - The fifth column
4.0K
: size of the file - The sixth column
Feb 19 15:35
: last modified time - The seventh column
docs
: file name
List all files and folders in the specified path.
Moving between Paths¶
Move to the docs
folder in the current path.
Move to the parent folder.
Move to the specified path.
Creating Folders¶
Copying and Moving¶
Copy a file.
Copy a folder.
Move a file or folder.
Deleting¶
Delete a file.
Delete a folder.
Checking Disk Space Usage¶
Managing Applications¶
Listing Processes¶
Monitoring Resource Usage¶
Clicking on the various headers (such as VIRT
, CPU%
) allows you to sort and view them.
Cpu
Please do not use all threads, and keep at least some threads available for other users to perform basic computing tasks. Unless necessary, do not use more than ⅔ of the maximum number of threads.
Memory
When using multiple processes (mainly for Python users), please limit the number of processes to avoid memory overflow. Memory overflow can lead to server crashes and other serious consequences.
Idle
When not in use for a long time, please close threads in a timely manner to release memory for other users to use. If you find that there is insufficient memory during use and other users are occupying a large amount of memory, please contact the user or coordinate with WenZhi Ding.
For checking Swap usage, please refer to this page.
Terminating Processes¶
Obtain the process ID (PID) from the ps
command or the htop
command above.
Text Operations¶
Configuration files in Linux are typically in the form of text (even if the file extension is not .txt
or there is no file extension at all). The easiest way to edit these files is to download them to your local machine via SFTP, edit them, and then upload them back to their original location.
However, for browsing and simple editing, you can do it directly in the SSH terminal. For example, for the config.ini
file:
The operation of Vim is different from traditional text editors. You can learn it from this tutorial.