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

Linux command-system application command

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

Share

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

Linux commands--system application commands

1. Time management

date: Display system time

clock: Display hardware time

hwclock -W: Synchronizes system time to hardware time

hwclock -s: synchronizes hardware time to system time

cal: Display calendar

Date of modification:

The order dated 9 January 1996 reads as follows:

#date -s 1/9/2009

Date and time set: August 8, 2008 12:00

date -s "2008-08-08 12:00:00"

Set the time to 14:36 p. M.

date -s 14:36:00

Remember to synchronize bios time after changing the time:

Synchronizing the BIOS clock forces the system time to be written to CMOS with the following commands:

#clock -w

2. Help orders

Internal command help: help COMMAND

External Command Help: man COMMAND

Command manual: manual

whatis COMMAND: Shows which section of man help this command is in.

============================================================

The man's command:

Space: Flip back one screen

b: Turn forward one screen

ENTER: Turn back one line

k: forward one line

============================================================

key lookup

/KEYWORD: search keywords backwards

?KEYWORK: Search keywords forward

n: Next keyword position

N: previous keyword

Q: Exit man help

3. System information

switch directory

cd Back to user's home directory

cd ~username: Enter the specified user's home directory

cd -: toggles between the current directory and the previous directory

cd ..: Switch to its parent directory

cd /home Go to '/ home' directory '

4、alise

Define aliases for shell commands

alias CMDALIAS=COMMAND

unalias CMDALIAS is an alias for the undo command

5、printenv

Display current variable information

6、whoami

Show who the current user is

su -: When switching, the user before switching is displayed

7、who

View the user currently logged into the system and the terminal he logged into

-r: Displays the current operating level

-H: The first time the list shows the column names

w: Display more detailed information than who

8、last

Displays the login log (/var/log/wtmp file) on the current system, including system user and restart information

last -n number: only shows the most recent login information

9、lastb

Show user error login common sense

lastb -n Number: Displays only the last few wrong logins

10、lastlog

Displays information about each user's last successful login

lastlog -u USERNAME: Displays the last login information of the specified user

11、basename

Displays the base name of a directory

basename /etc/abc/me Show me directly

$0: Command name or path to script itself.

basename $0: Call script path directly

12、mail

Mail view, you can view mail, after viewing will be placed in the user's home directory mbox folder.

-s theme

mail -s "How are you " root

cat /etc/fast | mail -s "How are you " root

13、hostname

hostname: Displays the name of the current host

hostname hostname: change hostname

14、fuser

Verify that the file or socket in use is being used

-v: View processes in use on a file

-k: Give the visiting process to kill

-km: Shut down all processes on the mount point

15、watch

Periodically execute specified commands and display results in full screen mode

Format: watch -n # 'COMMAND'

-n #: Specify the cycle, unit is seconds, default is 2 seconds

16、ps

View process information

BSD style common options:

a: Display all terminal-related processes?: It is not related to the terminal.

x: Displays all processes unrelated to the terminal

u: Display progress information

aux: combined use

SysV style common options:

-elF: View all progress information (e: All progress)

F: No details.

-o PROPERTY: Specifies property display

17、top

Dynamic display of process information

Support interactive, interactive commands

M: Sort by resident memory size

P: Sort by percentage of CPU usage

T: Sort by cumulative time

l: Whether average load and startup time are displayed

t: Whether to display information related to progress and CPU status

m: Whether to display memory-related information

c: Does the full command line information appear?

Q: Exit top

k: Terminate a process

Common options:

- d1: Refresh every few seconds

-b: batch mode display

-n #: How many batches are displayed in batch mode

18, foreground and background

foreground job: occupies command prompt

Background jobs: After startup, the command prompt is released, and subsequent operations are completed in the background

Front Desk--> Backstage:

Ctrl+Z: Send jobs to background

bg: Keep jobs stopped in the background running

bg [%JOBID]:% can be saved

fg: Send foreground jobs to background

fg [%JOBID]: % Can save SysV style common options:

-elF: View all progress information (e: All progress)

F: No details.

-o PROPERTY: Specifies property display

19、shutdown

shutdown [-akrhHPfnc] [-t secs] time [warning message]

shutdown: Command to shut down

-r now: restart immediately

-t sec: a few seconds later

-h now: shut down immediately

20、uname

uname -r: View system kernel version

uname -a: System version information

21、dd

Convert and copy files, copying the lowest data stream

Format: dd if= data source of= data storage destination bs=#how large is a unit count=#copy

How many times does this data

for example

dd if=/dev/sda of=/mnt/usb/mbr.backup bs=512 count=1

Can be used to backup MBR

Create Loop File

dd if=/dev/zero of=/var/swapfile bs=1M count=1024 This command creates a 1G image file, which can be directly mkswap and can be started.

/dev/zero is a bubble device that spits zeros out all the time

22、mktemp

mktemp: Create temporary files

mktemp /tmp/file.XX(XX stands for files automatically generated by the system) Generate temporary files

mktemp -d /tmp/file.xx: Generate temporary directory

23、at

at: Specify a task to be performed at some point in the future

time format

Absolute time: HH:MM DD:MM:YY MM/DD/YY

Relative time: now+#(minutes,hours,days,weeks)

Blur time: noon,midnight,teatime

at -l: Display your list of assignments

at -d Job Number: Delete Job

24、cron

cron: uninterrupted permitted service

System cron definition format:

Minutes Hours Days Months Weeks User Tasks

User cron task definition format

Definition file/var/spool/cron/USERNAME

Format: Minute Hour Day Month Week Task

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