xugaoxiang | 迷途小书童

Linux common commands-31: pgrep

The pgrep command is to retrieve running processes, showing matching process ID . Syntax format: pgrep [parameter] [mode] Common parameters: Example # 显示bash进程的pid pgrep bash # 多用户系统中,还可以指定用户再次过滤pgrep -u root bash This article is reprinted from https://xugaoxiang.com/2022/06/10/linux-cmds-31-pgrep/ This site is for inclusion only, and the copyright belongs to the original author.

Linux common commands-31: pgrep Read More »

Linux common commands-30: grep

grep means comprehensive search for regular expressions. It is a powerful text search tool for filtering and searching for specific characters, and it is also the most widely used command. Syntax format: grep [parameter] Common parameters: Example # 在文件中搜索字符串grep “putText” motion_detector.py # 在多个文件中搜索grep “putText” test1.py test2.py test3.py # 输出除了字符串外的其它内容grep -v “putText” test.py # 统计字符串出现的行数总数grep -c

Linux common commands-30: grep Read More »

Linux common commands-29: route

The route command is used to display and set the network routing information in linux , where the route refers to the static route. It should be noted that the route command is not permanently saved. Syntax format: route [parameter] Common parameters: Example # 显示当前路由route # 添加一条路由,多网卡可以通过dev来指定route add -net 192.168.1.1 netmask 255.255.255.0 dev eth0 #

Linux common commands-29: route Read More »

Linux common commands-28: ifconfig

ifconfig command is used to view and configure network parameters. The information configured using the ifconfig command does not exist after the network card is restarted or the machine is restarted. If you want to save it forever, you need to modify the configuration file of the network card. Syntax format: ifconfig [parameter] Common parameters:

Linux common commands-28: ifconfig Read More »

Linux common commands-27: whoami

The whoami command is to print out the user name logged in the current system. Syntax format: whoami [parameter] Common parameters: Example # 查询登录的用户名whoami This article is reprinted from https://xugaoxiang.com/2022/06/07/linux-cmds-27-whoami/ This site is for inclusion only, and the copyright belongs to the original author.

Linux common commands-27: whoami Read More »

Linux common commands-25: uname

The uname command is used to display system-related information, such as host name, kernel version number, hardware architecture, etc. Syntax format: uname [parameter] Common parameters: Example # 显示主机名uname -n # 显示内核信息uname -r # 显示硬件架构信息uname -i # 显示所有信息uname -a This article is reprinted from https://xugaoxiang.com/2022/06/06/linux-cmds-25-uname/ This site is for inclusion only, and the copyright belongs to

Linux common commands-25: uname Read More »

Linux common commands-24: telnet

Similar to ssh , the telnet command can also log in to the remote host. It also requires the remote host to open the corresponding service. The default port used is 23. Syntax format: telnet [parameter] Common parameters: Example # 登录远程主机telnet 192.168.1.100 # 也可以用来测试远程主机相应端口是否开启telnet 192.168.1.100 8080 This article is reprinted from https://xugaoxiang.com/2022/06/06/linux-cmds-24-telnet/ This site is

Linux common commands-24: telnet Read More »

Linux common commands-23: scp

scp is the abbreviation of secure copy . It is a secure remote file copy command based on ssh login under the linux system. It can copy files and directories between linux servers. Syntax format: scp [parameter] [file] Common parameters: Example # 将当前目录下的test.py拷贝到远程主机/home目录下scp test.py [email protected]:/home # 将当前目录下的文件夹test拷贝到远程主机/home目录下scp -r test [email protected]:/home # 从远程主机拷贝文件到本地scp [email protected]:/home/test.py . #

Linux common commands-23: scp Read More »

Linux common commands-22: ssh

The ssh command is a client connection tool in the openssh suite, which can realize remote management of the server. The server uses port 22 by default. Syntax format: ssh [parameter] [remote host] Common parameters: Example # 以当前系统用户登录远程主机ssh 192.168.1.100 # 指定用户登录远程主机ssh -l test 192.168.1.100 # 或者ssh [email protected] # 指定远程端口登录ssh -p 1024 [email protected] Common ssh client

Linux common commands-22: ssh Read More »

Linux common commands-21: find

The find command can find files or directories based on a given path and expression. It has a lot of parameters, and supports regular expressions. Combining pipeline commands can achieve complex functions. Syntax format: find [parameter] [path] [find and search scope] Common parameters: Example # 在当前目录下查找文件test.py find . -name test.py # 在当前目录下查找文件test.py,忽略大小写find . -iname test.py

Linux common commands-21: find Read More »

Linux common commands-20: tar

The role of the tar command is to create archives for files and directories, which is what we often call packaging. It should be noted here that packaging is packaging, and compression is compression. Syntax format: tar [parameter] [file or directory] Common parameters: Example # 将当前文件夹下的jpg文件打包tar -cf images.tar *.jpg # 打包后删除jpg文件tar -cf images.tar *.jpg –remove-files

Linux common commands-20: tar Read More »

Linux common commands-19: history

The history command is used to display the historical commands executed by the user before, and can also perform operations such as appending and deleting historical commands. History commands will be written to the local file ~/.bash_history . Syntax format: history [parameter] [directory] Common parameters: Example # 显示所有历史命令history # 显示最近5条历史命令,包括本条history命令在内history 5 # 清空历史命令history -c #

Linux common commands-19: history Read More »