Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

2. Introduction to shell and common commands

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Shell:

Is a command-line tool that acts as a translator between the user and the kernel. The specific calls are as follows:

The user enters the command, tells the terminal, and he will call the corresponding program or service, then the system calls the interface, goes to the kernel, and finally to the hardware.

Common system commands:

Echo: used to output string or variable extracted value date: returns the current system time

Display time by year, month, day, minute and second: date "+% Y-%m-%d% H:%M:%S"

Setting time: date-s "20200202 2:22:22"

Check today is the day of the year: date "+% j" reboot: restart poweroff: shutdown wget download software package:

-b backend download

-P download to the specified directory

-t maximum attempts

-C breakpoint continuation

-p download all the resources on the page, including pictures, videos, etc.

-r Recursive download ps: view system status

-aux displays the left and right processes users follow other details or processes without control terminal top: check the running status of the system pidof: add the process name to display the pidkill of the process: terminate the process

System status detection commands:

Ifconfig (ip a): can view network card name IP address mac address uname:-a can view system kernel name, hostname, kernel release version, node name, system time, hardware name, hardware platform, processor type and operating system and other information uptime: used to view system load information load average is followed by the last 1 minute, 5 minutes and 15 minutes of system pressure. Free: view system memory who: view current login host information last: view all user login records history: view history commands executed

Working directory switch command:

1.pwd: view your working directory

2.cd: switch working directory

3.ls: view the file information in the current directory

Text file editing commands:

Cat: view the text file more: suitable for viewing multi-content file head-n 20 file name: view the first 20 lines of the file tail-200f file name: view the last 200 lines of the file, and can be a continuous refresh command tr: can replace the characters in the file, cat aaa.txt | tr [Amurz] [Amurz]: replace case wc-l file name: show the number of file lines;-w: display the number of words -c: display the number of bytes stat file name: you can view the file specific storage information and time and other information cut: used to extract information by column: cut-d:-F1 / etc/posswd: extract the first column of content diff-- brief: compare whether the contents of the two files are consistent;-c: display specific content that is not allowed

File directory management commands:

Touch file name: create an empty file mkdir directory: create a new directory;-p: recursively create cp: copy file or directory mv: cut command, usually the user renames the file rm: delete

Package Compression and search commands:

Tar-czvf etc.tar.gz / etc: compress the file under / etc into etc.tar.gz file tar-xzvf etc.tar.gz-C path: extract to the specified path grep search keyword file: search according to keyword in the file find:/-name filename: search under /. Find a file

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report