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 xshell commands?

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

This article mainly introduces what the xshell command has, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.

(1) Command ls-- to list files

Ls displays the current directory files

Ls-la gives a long list of all files in the current directory, including "hidden" files that begin with a period

Ls a * lists all files in the current directory that begin with the letter a

Ls-l * .doc gives all files ending in .doc in the current directory

(2) order cp-- to copy files

Cp afile afile.bak copies the file as a new file afile.bak

Cp afile / home/bible/ copies the file afile from the current directory to the / home/bible/ directory

Cp * / tmp copies all unhidden files in the current directory to the / tmp/ directory

Cp-a docs docs.bak recursively copies the docs directory under the current directory to the new directory docs.bak, preserving file attributes, and copying all files, including hidden files that begin with a period. For convenience, the-an option contains the-R option

Cp-I asks the user before overwriting

Cp-v tells users what they are doing

Cp-r

(3) Command mv-- to move and rename the file mv aflie bfile to rename afile to bfile

Mv afile / tmp moves the afile from the current directory to the / tmp/ directory

(4) order rm-- to delete files and directories rm afile delete files afile

Rm * deletes all files in the current directory (no files are hidden). The rm command does not delete directories unless the-r (recursive) parameter is also specified.

Rm-rf domed deletes the domed directory and everything it contains

Rm-I a * deletes all files in the current directory that begin with the letter a, and prompts the user for confirmation each time it is deleted

(5) order cd-- to change the directory

Cd changes to the home directory

Cd ~ switch to home directory

Cd / tmp changes to directory / tmp

Cd dir changes to the dir directory under the current directory

Cd / switch to the root directory

Cd.. Switch to the previous directory

Cd.. /.. Switch to the upper secondary directory

Cd ~ switch to user directory, such as root user, then switch to / root

(6) order mkdir-- to create a directory

Mkdir phots establishes a directory called photos in the current directory

Mkdir-p this/that/theother establishes a specified nested subdirectory under the current directory

(7) order mkdir-- to delete the directory

Mkdir will delete the empty directory

(8) commands more and less-- to view file contents

More / etc/passwd View the contents of / etc/passwd

Function: paging display command

More file

The more command can also be used with other commands through the pipe character (|), for example: ps ux | more ls | more

Less / etc/passwd View the contents of / etc/passwd

(9) Command grep-- to search for file contents

Grep bible / etc/exports finds all lines that contain bible in the file exports

Tail-100 / var/log/apache/access.log | grep 404 looks for lines containing "404" in the last 100 lines of the WEB server log file access.log

Tail-100 / var/log/apache/access.log | grep-v googlebot looks for lines that are not accessed by google in the last 100 lines of the WEB server log file access.log

Grep-v ^ # / etc/apache2/httpd.conf look for all non-comment lines in the main apache configuration file

(10) Command find-- to find files

Find.-name *. Rpm looks for rpm packages in the current directory

Find. | grep page looks for files with file names containing page in the current directory and its subdirectories. Locate traceroute looks for files with file names containing traceroute anywhere in the system

(11) Command vi-- to edit the file

Gvim Open Program

Vi / etc/bubby.txt edits the file / etc/bubby.txt with vi

Vim / etc/bubby.txt edits the file / etc/bubby.txt with vi

Quick operation:

Toggle window: alt+1,alt+2

Full screen: enter alt+

Suspend (pause) vim: ctrl+z. After pausing, you can perform other shell operations. After that, you can switch back to the vim interface with the fg command to continue editing.

: MR: view history records (note: MR uppercase)

Sp switch interface window horizontally

Vsp vertical switch interface window to facilitate multiple file control coding (figure below:) emacs / etc/bubby.txt use emacs to edit files / etc/bubby.txt

(12) order rz and sz-- files to upload and download

Run the command Sudo rz, that is, to receive the file, xshell will pop up the file selection dialog box, after selecting the file, close the dialog box, the file will be uploaded to the current directory in linux.

Running the command Sudo sz file is to send files to windows (the saved directory is configurable) is much more convenient than the ftp command, and the server no longer has to open the FTP service.

(13) Command cat-- to display file contents

Cat file

(14) Command ps-- to view the process ps [options]

DESCRIPTION (description): the ps command displays some information about the options for running the program. If you want to display some repetitive information about the options, use the top command instead.

Use standard syntax to view every process on the system.

Ps-e

Ps-ef

Ps-eF

Ps-ely

(15) order kill-- to kill the process

[root@linux ~] # kill-signal% jobnumber

[root@linux ~] # kill-l

Parameters:

-l: this is the lowercase of L, listing what signal can be used by kill at present? There are 62 signals.

Signal: what kind of instructions should be given to the next job? With man 7 signal, you can see:

-1: reread the parameter profile (similar to reload)

-2: represents the same action as typing [ctrl]-c on the keyboard.

-9: force a job to be deleted immediately

-15: terminate a job in a normal procedural manner. It's not the same as-9.

Example 1: find out the background work in the current bash environment and delete the work.

[root@linux ~] # jobs

[1] + Stopped vim bashrc

[root@linux ~] # kill-9% 1

[1] + vim bashrc has been cut

(16) Command stop and start-- to restart tomcat

. / catalina.sh stop

. / catalina.sh start

(17) Command top-- to view cpu and memory

(18) Command pwd-- to view the current path

(19) order tar-- to pack and unpack rar

Tar-cvf *. Tar a.jsp b.java type an and b into *. Rar

Tar-xvf *. Tar a.jsp b.java unpack *. Tar

(20) Command tail-- to view file details

Tail-f aaa.txt see the details of the aaa.txt file

Tail-n x aaa.log x: last few lines

(21) Command head-- to view the name and suffix of the file

Head-n x aaa.log x: the first few lines aaa.log: the name and suffix of the file to view

(22) Command diff-- to compare file contents

Diff dir1 dir2 compares whether the list of files in directory 1 is the same as that in directory 2, but does not compare the actual contents of the files.

Diff file1 file2 compares whether the contents of file 1 and file 2 are the same. If it is a file in text format, the content will be different. If it is binary code, it only means that the two files are different.

Comm file1 file2 compares files to show the different contents of the two files

(23) Command ln-- to establish a connection

Ln source_path target_path hard connection

Ln-s source_path target_path soft connection

(24) Command touch-- to create an empty file

Touch aaa.txt creates an empty file named aaa.txt

(25) Command man-- to view the help of a command

Man ls displays the help content of the ls command

(26) Command wmurf-displays the details of the logged in user

Sarge:~# w

(27) the command who-- displays the logged in user

Sarge:~# who

(28) Command last-- to see which users have logged in to the system recently

Sarge:~# last

(29) Command date-- system date setting

The setting period of date-s "060520 06:00:00" is 6: 00 sharp on May 20, 2006.

(30) order

Clock-- clock settin

Clock-r reads time parameters in system Bios

Clock-w writes the system time (such as the time set by date) to Bios

(31) Command uname-- to view the system version

Uname-R displays the version of the operating system kernel

(32) Command reboot, shutdown-- to shut down and restart the computer

Reboot restart the computer

Shutdown-r now restart the computer, restart the computer after stopping the service

Shutdown-h now shuts down the computer, stops the service and then shuts down the system

Halt shuts down the computer

Shutdown-r now is generally used, and when the system is restarted, the relevant services are turned off, as is the case with shutdown-h now.

(33) Command su-- to switch users

Su-switch to root user

Su-zhoulj switches to zhoulj user

Note:-- it's critical, use-- will use the user's environment variable

(34) Command free-- to view memory and swap partition usage

Sarge:~# free-tm

(35) Command uptime-- current time, elapsed time between the boot of the system and now, the number of connected users, the last minute, five minutes and fifteen minutes of system load

Sarge:~# uptime

(36) Command vmstat-- to monitor virtual memory usage

# vmstat

(37) Command iostat-- disk Throughput

-c displays only CPU lines

-d display disk row

-k displays disk output in kilobytes

-t includes a timestamp in the output

-x includes extended disk metrics in the output

(38) order clear-- to clear the screen

Clear

(39) restart tomcat

(40) change the user chown

Change the owner or group chown-R-h owner file of the file or directory

The-R (recursive) option means that you do the same for files in all subdirectories.

The-h option means that changing the owner of a symbolic link file does not affect the target file that the link points to

Chown-R xh test1 (all file owners of the test1 directory and subdirectories become xh)

Thank you for reading this article carefully. I hope the article "what are the xshell commands" shared by the editor will be helpful to you. At the same time, I also hope that you will support us and pay attention to the industry information channel. More related knowledge is waiting for you 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

Internet Technology

  • How to integrate Swagger2 in SpringBoot

    In this issue, the editor will bring you about how to integrate Swagger2 in SpringBoot. The article is rich in content and analyzes and narrates it from a professional point of view. I hope you can get something after reading this article. The first step is to add dependency

    © 2024 shulou.com SLNews company. All rights reserved.

    12
    Report