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

What are the common commands of CentOS system in Linux

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article mainly introduces which commands are commonly used in CentOS system in Linux. It is very detailed and has certain reference value. Friends who are interested must finish reading it.

Common command

1. Shut down the system

Shutdown-h now

two。 Specify a scheduled time to shut down the system

Shutdown-h hours:minutes & timing shutdown

3. Cancel the scheduled time to shut down the system

Shutdown-c

4. Restart the system

# Mode 1: shutdown-r now # Mode 2 reboot

5. File directory related operations

Cd / home # enter the'/ home' directory'cd.. # return to the next level directory cd # enter the personal home directory cd-# return to the last directory pwd # display the working path ls # View the files in the directory ls-F # View the files in the directory ls-l # display the details of files and directories ls-a # Show hidden files tree # Show files and directories tree structure lstree # showing files and directories starting from the root directory The initial tree structure mkdir dir1 # creates a directory called 'dir1'' mkdir dir1 dir2 # also creates two directories mkdir-p / tmp/dir1/dir2 # creates a directory tree rm-f file1 # deletes a file called 'file1'' rmdir dir1 # deletes a directory called 'dir1'' rm-rf dir1 # deletes a directory called 'dir1' and deletes its contents rm- Rf dir1 dir2 # delete both directories and their contents mv dir1 new_dir # rename / move a directory cp file1 file2 # copy a file cp dir/*. # copy all files in a directory to the current working directory cp-a / tmp/dir1. # copy a directory to the current working directory cp-a dir1 dir2 # copy a directory cp-r dir1 dir2 # copy a directory and subdirectory find /-name file1 # enter the root file system from'/'to search for files and directories find /-user user1 # search for files and directories belonging to the user 'user1'

6. Disk related operation

Mount / dev/hda2 / mnt/hda2 # Mount a disk called hda2-make sure the directory'/ mnt/hda2' already exists mount / dev/fd0 / mnt/floppy # Mount a floppy disk mount / dev/cdrom / mnt/cdrom # Mount a cdrom or dvdrom mount / dev/hdc / mnt/cdrecorder # Mount a cdrw or dvdrom mount-o loop file.iso / mnt/cdrom # Mount a file or ISO image df-h # shows that List of mounted partitions ls-lSr | more # arranges files and directories by size du-sh dir1 # estimates the directory 'disk space already used by dir1''

7. Users and groups

Groupadd group_name # create a new user group groupdel group_name # Delete a user group groupmod-n new_group_name old_group_name # rename a user group useradd user1 # create a new user userdel-r user1 # Delete a user ('- r' excludes the home directory)

7. File permissions

# Digital change permission method # r read permission read 4w write permission write 2roomx operation permission execute 1chmod permission digital file name # View permission ls-l xxx.xxx (xxx.xxx is the file name)

8.CentOS 7.0Firewall

# View firewall status # turn on display running Display not runningfirewall-cmd after shutdown-- state# disable firewall systemctl stop firewalld.service# enable firewall systemctl start firewalld.service# firewall start systemctl enable firewalld.service# restart firewall systemctl restart firewalld.service# open designated port firewall-cmd-- add-port= port / tcp-- restart firewall firewall-cmd-- reload# check whether the specified port is enabled or not-- query-port=6379/tcp to Is all the content of the article "what are the common commands of CentOS systems in Linux?" Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

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

Development

Wechat

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

12
Report