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

Linux basic operating instruction

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

Share

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

Linux basic operating instruction

1. Directory related instruction

Ls instruction to browse the contents of the directory

-a view the hidden file linux to. The first files are hidden files.

-l view file details

Pwd directive to view the current path (absolute path)

. Current path

.. The upper path of the current directory

/ home/aircraft

.. / aircraft

. /

Mkdir create directory

-p Recursively create a multi-level directory

Rmdir delete empty directory

-p Recursively delete multi-level empty directories

Rm deletes ordinary files by default

-r Delete a directory (delete a directory and all files under it)

-f ignore prompts and operate directly

Cp will copy the specified file to the specified directory.

-r copy directory (copy directory and all files under it)

Mv moves the specified file or directory to the specified path

-I add prompt information

Cd changes the current path

~ quickly return to the current user's home directory

two。 File related command

Touch creates a new empty file if the file does not exist, otherwise refresh the file time attribute

-d refresh 'yyyy-mm-dd HH:MM:SS'q at a specified time

Cat prints all the contents of the file directly to the terminal for display.

More pagination displays the contents of the file

The space turns down the page.

Press enter to scroll down the line

Q exit

Less pagination displays the contents of the file

Fhand b turn the page up and down

JCompk scrolls up and down the line

Q exit

/ string matches the specified string string down

? string matches the specified string string up

Head displays the first n lines of the file

Head-n num file

Tail displays the last n lines of the file

Tail-n num file

Tail-f file dynamically refresh the end of the file

3. Compress and decompress command:

Compression and decompression command in zip/unzip zip format

Zip *. Zip file1 file2....

Unzip *. Zip

Compression and decompression of gzip/gunzip gzip format

Gzip file1 file2...

Gunzip * * .gz

Compression and decompression of bunzip2/bzip2 bzip2 format

Bzip2 file1 file2...

Bunzip2 * * .bz2

Tar packages / unpacks files / directories

-C packing

-x unpack

-v display packaging / unpacking information at the same time

-z compress / decompress gzip format while packing / unpacking

-j compress / decompress bzip2 format while packing / unpacking

-f command for specifying compressed packages (usually the last option)

Tar-czvf test.tar.gz file1 file2 dir1 dir2

Tar-xzvf test.tar.gz

4. Match find command

Grep matches the line containing the specified string in the file

-I ignore case to match grep-I "string" file

-v matches the line grep-v "string" file that does not contain the specified string

-R recursively matches the strings of all files in the specified directory

Grep-R "root". /

Find looks for the specified file in the specified directory

-name looks for files by file name

-size finds files by file size

-type b/f/d/p/l/s/c finds files by file type

-atime /-ctime /-mtime

-amin /-cmin /-mmin look for files at different times

5. Other commands

Standard output redirection

> > overload orientation-every time new data is appended to the end of the file

Empty redirection-each time you empty the original contents of the file, and then write the data

Echo "hello" > > a.txt

Su switching user

Ifconfig to view Nic information

Man View Command Manual man ls

Date view or this is system time

+% s View timestamp-seconds from 1970 to now

+ "Y-%m-%d H:%M:%S" displays the time in the specified format

-s' yyyy-mm-dd HH:MM:SS' sets the system time in the specified format

Ctrl+c interrupts the current operation

Tab automatic completion

Shutdown-h now shutdown

Reboot restart

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