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

Summary of Linux commands that beginners must master

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

Share

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

This article mainly explains "the summary of Linux commands that beginners must master". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn the summary of Linux commands that beginners must master.

1. Basic file directory operation

Ls command: means to list the contents of the directory (List Directory Contents). Run it to list the contents of the folder.

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

$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

$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

$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 command: print the current directory, that is, display the full path of the current working directory in the terminal.

The code is as follows:

# pwd

/ root/lnmp

Cd command: switch directories in terminal

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 command: create a new directory

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 command: delete files or directories (please use it carefully)

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 command: moving files or folders

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 command: copying files or directories

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: downloading files from the network

The code is as follows:

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

Cat & & grep: view file contents and powerful pipe commands

[code] $cat vhost.sh | grep linuxeye # shows vhost.sh to filter lines containing linuxeye characters

II. View and management of system resources

Df-h

The code is as follows:

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

III. 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

The code is as follows:

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

$unzip-Q linuxeye.zip # quiet zip decompression

IV. MySQL database operation

The code is as follows:

# mysqldump-uroot-pmysqlpwd-- opt-- database linuxeye > linuxeye.sql

Root is the user name, mysqlpwd is the password, linuxeye database name, sql after linuxeye.sql backup

# mysql-uroot-p # Command Line to enter MySQL Management

Enter password:

Mysql > source linuxeye.sql # Import sql, which is usually used for database recovery

As a result, the above commands will enable beginners to master basic application commands on Linux and upgrade from rookie level to entry-level users through skillful use of these commands.

At this point, I believe that everyone on the "novice must master the Linux command summary" have a deeper understanding, might as well to the actual operation of it! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

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