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 commonly used commands under Linux

2025-01-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

In this article, the editor introduces in detail "what are the commonly used commands under Linux", the content is detailed, the steps are clear, and the details are handled properly. I hope this article "what are the commonly used commands under Linux" can help you solve your doubts? let's follow the editor's ideas slowly to learn new knowledge.

Archiving: tar

Common examples

Create: tar-cf Archive path Archive Source File path View Archive content (list) tar-tf Archive path release Archive (decompress) tar-xf Archive path (ps: release to the current directory)

Several supported compression formats can be applied to archiving

Format suffix parameter command gzip * .tar.gz-z tar-czf path after archiving bzip2 * .tar.bz2-j tar-cjf path to large packets zx * .tar.z-J tar-cJf path to large packets after archiving

Parameter meaning

C create t only view v display details x release f add parameter z * .tar.gz file creation j * .tar.bz2 file creation J * .tar.z file creation

Common combination

Tar-cvf create archive tar-vtf display (list) archive contents tar-cv [z / xvf] f create compressed archive tar-xvf unzipped compressed file decompressed ssh file copy: SCP

Format

Scp source file path destination file path

Path to the remote host (format): user@host: file path

Ps:user@ is optional. It defaults to the address of the current user (remote authentication) host as the host. It can be either an ip address or a resolvable domain name and computer name.

Example: [root@localhost~] # scp / etc/yum.repos.d/redhat.repo 192.168.1.1:/etc/yum.repos.d/source.repo ps: this command securely copies the local yum repository as the root of the remote machine to the / etc/yum.repos.d/ of the remote machine 192.168.1.1 and renames it to scource.repo

Example: [root@localhost~] # scp / etc/yum.repos.d/redhat.repo 192.168.1.1:scource.repo ps: this command securely copies the local yum repository as the root of the remote machine to the authenticator directory of the remote machine 192.168.1.1 and renames it to scource.repo

Example: [john@localhost~] # scp tom@www.baidu.com: meeting minutes .txt / tmp/ meeting / ps: this command is to securely copy the "meeting minutes .txt" under the authenticated user home directory (/ home/tom/) of the remote machine www.baidu.com to the local "/ tmp/ meeting minutes /".

Secure ftp:SFTP

Format

Sftp user@host

Commands available in sftp: get download, put upload, cd switch, pwd current location, mkdir and other ps:user@ optional. None is the default current user (remote authentication) host is the address of the host, which can be ip address or resolvable domain name and computer name.

After logging in to the remote, the path is the home directory of the remote login user. When using the get command, the default download path is the current local directory.

For example: root@..#sftp 192.168.1.1sftp > pwdsftp > / rootsftp > cd / etc/yum.repos.d/sftp > lssftp > source.reposftp > get source.reposftp > exit#ls#source.repops: log in as the current user by default, enter the authenticated user's home directory by default, and get downloads are stored locally in the current directory by default. Example: root@..#sftp tom@www.baidu.comsftp > pwdsftp > / home/tomsftp > cd / etc/yum.repos.d/sftp > lssftp > sftp > put source.reposftp > lssftp > source.reposftp > exit#ls#source.repo synchronization tool: rsync

Format

Rsync (file path) (file path) PS: can be understood as file synchronization between two hosts (replication) rsyn-av source destination (an attribute, selinux synchronization)

Rsync-av / etc/fstab root@www.baidu.com:test/rsync-av / etc/123/ root@www.baidu.com:test/ pay attention to whether the directory or directory content is synchronized rsync-av a / root@www.baidu.com:b/ps: that is to synchronize the files in the local a / to the files in the b / in the remote machine, which can be understood as synchronizing the things of an into b Files with the same directory file name overwrite (replace) ls a 1 2 3 4 5 6 7ssh root@www.baidu.com...ls b1 9 0 3 2 after synchronization: rsync-av a / root@www.baidu.com:b/ls a 1 2 3 4 5 6 6 7ssh root@www.baidu.com...ls b1 9 0 3 2 4 5 6 7 where 1 2 3 4 5 6 7 is exactly the same as in a This article "which commands are commonly used under Linux" has been introduced. If you want to master the knowledge points of this article, you still need to practice and use it yourself. If you want to know more about related articles, 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