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 files and network operation commands in Linux

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

Share

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

Today, I will talk to you about the files and network operation commands in Linux, which may not be well understood by many people. in order to make you understand better, the editor has summarized the following contents for you. I hope you can get something according to this article.

Ls

The code is as follows:

$ls # View the files in the current directory

Conf lnmp_install.sh README vhost_ngx_pagespeed.sh

Init.sh ngx_pagespeed.sh source vhost.sh

The code is as follows:

$ls conf # View the files in the conf directory

Index.html nginx.conf pureftpd-mysql.conf tz.php

Init.d.nginx pure-ftpd.conf script.mysql

The code is as follows:

$ls-a # shows all files (including hidden files starting with a dot (.))

. Conf lnmp_install.sh README vhost_ngx_pagespeed.sh

.. Init.sh ngx_pagespeed.sh source vhost.sh

The code is as follows:

$ls-l # displays the details of the file in a long format, and you can view the file permissions, user, date, etc.

Total 60

Drwxr-xr-x 2 root root 4096 Jul 25 18:14 conf

-rwxr-xr-x 1 root root 5720 Jul 25 18:14 init.sh

-rwxr-xr-x 1 root root 21011 Jul 25 18:14 lnmp_install.sh

-rwxr-xr-x 1 root root 1983 Jul 25 18:14 ngx_pagespeed.sh

-rw-r--r-- 1 root root 392 Jul 25 18:14 README

Drwxr-xr-x 15 root root 4096 Jul 27 13:58 source

-rwxr-xr-x 1 root root 4865 Jul 26 21:58 vhost_ngx_pagespeed.sh

-rwxr-xr-x 1 root root 3774 Jul 25 18:14 vhost.sh

Pwd # print the current directory

The code is as follows:

# pwd

/ root/lnmp

Cd

The code is as follows:

# cd.. / # enter the upper directory

# cd.. /. / # enter the upper directory

# cd ~ # enter the current user's home directory

# cd / root/lnmp/conf # enter the / root/lnmp/conf directory

Mkdir

The code is as follows:

$mkdir linuxeye # create a linuxeye directory

$mkdir-p backup/sql # Recursive create a directory (if the directory does not exist, then create it)

Rm

The code is as follows:

$rm init.sh # Delete init.sh files (directories cannot be deleted without the-r parameter)

$rm-r conf # Recursively delete files or directories (you can delete folders, you will be asked if you want to delete them, enter y for confirmation, and then enter enter)

$rm-rf backup # will not ask (the-f parameter is used cautiously), and delete files or directories recursively

Mv

The code is as follows:

$mv linux linuxeye # rename the linux file or directory to linuxeye

$mv vhost.sh conf/ # move vhost.sh to the conf directory

Cp

The code is as follows:

$cp linux linuxeye # make a copy of the linux file named linuxeye (if there is a linuxeye directory, copy the linux file to the linuxeye directory without changing the file name to linux)

$cp-r linuxeye/ conf/ # copy the linuxeye directory (including the files) to the conf directory

Wget

The code is as follows:

$wget / / blog.linuxeye.com/wp-content/uploads/lnmp.tar.gz # download file, add the parameter-c breakpoint to resume upload;-T sets the timeout followed by seconds

Cat & & grep

The code is as follows:

$cat vhost.sh | grep linuxeye # shows vhost.sh filtering lines containing linuxeye characters

Awk

Take a public network ip address

The code is as follows:

Ifconfig | grep 'inet addr:' | cut-d:-f2 | grep-v ^ 10\. | grep-v ^ 192\ .168 | grep-v ^ 172\. | grep-v ^ 127\. | | awk'{print $1}'| awk'{print;exit}'|

System resource management

The code is as follows:

Df-h

Filesystem Size Used Avail Use% Mounted on

/ dev/xvda 24G 13G 9.9G 55% /

Tmpfs 501m 108K 501m 1% / dev/shm

Top # dynamic View process consumes resources (cpu, memory)

Top-H # View the resource consumption of each thread

Free-m # to check memory and swap usage, top can also see

Compression and decompression

Tar

The code is as follows:

$tar czf linuxeye.tar.gz. / linuxeye # tar package compression

$tar xzf linuxeye.tar.gz # decompress

The zip & unzip # plus-Q parameter does not show the compression process

$zip-r linuxeye.zip. / linuxeye # zip compression

$unzip-Q linuxeye.zip # quiet zip decompression

After reading the above, do you have any further understanding of the files and network operation commands in Linux? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

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