Developers must have a Linux command

Developers must have a Linux command

Linux developers commonly used commands necessary to master these commands absolutely enough, based on CenterOS7.6.

System Management Services

systemctl

  • Output status of each service system:
systemctl list-units --type=service

img

  • View the running status of the service:
systemctl status firewalld

img

  • Close Services:
systemctl stop firewalld

img

  • Start the service:
systemctl start firewalld

img

  • Restart the services (regardless of the current service is started or shut down):
systemctl restart firewalld
  • Reload the configuration information without interrupting service:
systemctl reload firewalld
  • Prohibit service boot from the start:
systemctl disable firewalld

img

  • Set service boot from the start:
systemctl enable firewalld

img

Document Management

ls

Lists the current directory (/) all the files under:

ls -l /

img

pwd

Gets the current working directory where the absolute path

img

cd

Change the current working directory:

cd /usr/local

img

date

Display or modify the system time and date;

date '+%Y-%m-%d %H:%M:%S'

img

passwd

Used to set user passwords:

passwd root

img

its

Change the user identity (switch to superuser):

su -

clear

Clears the screen information

man

Displays help information for the specified command:

man ls

who

  • Discover what the system is run level:
who -r

img

  • Displays the current user logged on to the system:
who -buT

img

free

Displays the system memory status (in MB):

free -m

img

ps

Dynamic Display System processes running:

ps -ef

View sshd running dynamic process:

ps -ef | grep sshd

img

top

View real-time dynamic process, similar to Windows Task Manager

img

mkdir

Create a directory

img

more

When the paging file is too long for viewing the contents of the file 10 lines per page View boot.log file

more -c -10 /var/log/boot.log

img

cat

View Linux boot log file and line number indicate:

cat -Ab /var/log/boot.log

img

touch

Create a file text.txt:

touch text.txt

img

rm

  • Delete Files:
rm text.txt
  • Forced to delete a directory and its subdirectories:
rm -rf testdir/

img

cp

Test1 test2 to copy the directory to the directory

cp -r /mydata/tes1 /mydata/test2

mv

Move or overwrite the file:

mv text.txt text2.txt

Compression and decompression

takes

  • The file / etc folder to the archive file etc.tar (not compressed):
tar -cvf /mydata/etc.tar /etc
  • File / etc are compressed with gzip folder to the etc.tar.gz:
tar -zcvf /mydata/etc.tar.gz /etc
  • With bzip2 compressed folder / etc to file /etc.tar.bz2:
tar -jcvf /mydata/etc.tar.bz2 /etc

img

  • Page View archive content (gzip):
tar -ztvf /mydata/etc.tar.gz |more -c -10

img

  • Unzip the file to the current directory (gzip):
tar -zxvf /mydata/etc.tar.gz

Disk and network management

df

Check disk space occupancy:

df -hT

img

ie

View the current file and share files in a directory folder size:

du -h --max-depth=1 ./*

img

ifconfig

Displays the current status of network interfaces

img

netstat

  • View the current routing information:
netstat -rn

img

  • View all active TCP connections:
netstat -an
  • View the system start listening service:
netstat -tulnp

img

  • View system resources in a connected state:
netstat -atunp

wget

Download the file from the network

img

Installation and management software

rpm

  • Install the package: rpm -ivh nginx-1.12.2-2.el7.x86_64.rpm
  • Fuzzy Search packages: rpm -qa | grep nginx
  • Exact Match packages: rpm -qa nginx
  • Query package installation path: rpm -ql nginx-1.12.2-2.el7.x86_64
  • View summary information package: rpm -qi nginx-1.12.2-2.el7.x86_64
  • Verify the contents of the package and installation files are consistent: rpm -V nginx-1.12.2-2.el7.x86_64
  • Update Packages: rpm -Uvh nginx-1.12.2-2.el7.x86_64
  • Remove a package: rpm -e nginx-1.12.2-2.el7.x86_64

yum

  • Install the package: yum install nginx
  • Checks can be updated package: yum check-update
  • Updates the specified package: yum update nginx
  • Look for package information repository: yum info nginx *
  • All listed packages already installed: yum info installed
  • Lists the package name: yum list nginx *
  • Fuzzy Search packages: yum search nginx

Guess you like

Origin www.cnblogs.com/guoyinghome/p/11220267.html