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

Unix basic course 12 system Management

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

Share

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

1. Disk management

1) disk space detection command: df

Displays free blocks (512B/ blocks) and idle inodes (number of new files that can be created) in each logical disk in the current system

$df

$df-t (- t gives the total number of file system blocks)

2) disk usage statistics: du

Statistics of disk usage in specified directories and all subdirectories (in blocks)

$du

$du-a. / run/tmp (statistics on directories and all their subdirectories and files)

2. File system management: fsck (only root can be used)

Detect and fix file system errors

1) check blocks and size checks the file size and the number of blocks used in the Inode table

2) check pathnames checks the correctness of directories and file paths

3) check connectivity checks the connection between directories

4) check reference counts checks the reference count of each file

5) check free list checks the free block table of the file system

3. File storage and backup: tar

Pack, back up, or transfer a file or group of files

Format:

$tar-cvf target file1 file2 file3 backs up file1, file2 and file3 to target

$tar-tvf target checks the file information contained in the archive file target

$tar-xvf target [file] extract all or file-specified files from the archive file target

Options:

C create

V detection

F target file

T test, check

X unpack

4. System start and stop

1) system initialization control process init

2) / etc/inittab file describes the process of establishing each system

3) different levels of operation

# init [01236]

0 shut down all kinds of system resources and shut down the computer

1 enter the single-user state and refuse the login of ordinary users

2 enter the ordinary multi-user state and allow ordinary users to log in

3 enter the multi-user state with network function (normal state)

6 shut down various system resources and restart the operating system

Control program:

Various control files to be executed when rc0.d shuts down

Various control files when the rc1.d system enters a single user

Various initialization files when rc2.d system enters ordinary multi-user

Various initialization files when a rc3.d system enters a multiuser state with a network

Various control files for the follow-up work that need to be completed when the rc6.d system is to be restarted.

5. System shutdown command: shutdown

1) shutdown [- hr] time [message]

-h full shutdown

-r shut down and restart

Time time

Information sent to all logged-in users when message shuts down

2) case

# shutdown-r now

# shutdown-h + 5 "system will shutdown in 5 minutes"

6. File encryption and compression

1) File encryption command: crypt

Crypt file.cry encrypts file, and the result is saved in file.cry

$crypt aaa decrypts aaa.cry, and the result is saved in aaa

$vi-x file.cry

Description: (1) the size before and after encryption is the same. (2) crypt automatically identifies whether the encrypted format is encrypted. If so, decrypt it.

2) File compression and decompression: compress/uncompress

The file name becomes file.z after $compress file is compressed

$uncompress file.z

7. Execute tasks regularly

1) users perform tasks regularly: at

The default is sent to the executor as the result of emailing the at command, which is usually available to only a small number of users

/ usr/bin/sh

$at 0815 is ready to perform a task at 08:15

Who > > userlist

Crtl+D

2) the system executes tasks regularly: cron

Under the / usr/spool/cron/crontabs directory

Minute hour monthday month weekday command (weekday:0-6)

0 0 * > / var/adm/wtmp

0 * rm-r / tmp/* 2 > / dev/null clears the temporary directory at 00:00 every day

Userlist records the login of users every 20 minutes

3) Management command for task description file: crontab

To edit the above file, the editing process is exactly the same as the vi command

# crontab-e [username] Editor

# crontab-l [username] View

# crontab-r [username] Delete

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