xugaoxiang | 迷途小书童

Linux common commands-18: ping

The ping command is mainly used to test the network connectivity between hosts. ping uses the ICMP transport protocol. Syntax format: ping [parameter] [target host] Common parameters: Example # 基本使用,ip也可以换成域名或主机名ping 192.168.1.100 # 设置ping的次数ping -c 10 192.168.1.100 # 设置ping的次数及间隔,单位是秒ping -c 10 -i 2 192.168.1.100 This article is reprinted from https://xugaoxiang.com/2022/06/04/linux-cmds-18-ping/ This site is for inclusion only, …

Linux common commands-18: ping Read More »

Linux common commands-17: mount

The mount command is used to mount the file system to the specified mount point (that is, the directory). Commonly used in server version to mount U disk and use network file system NFS . Syntax format: mount [parameter] Common parameters: Example # 查看所有挂载mount # 将sdb设备的第一个分区挂载到/mnt目录下。如果系统中只有一块硬盘,接入u盘后,一般sdb1就是u盘,可以查看/dev/下的设备节点来确认mount /dev/sdb1 /mnt # 指定文件系统类型mount -t ext4 /dev/sda5 /tmp # …

Linux common commands-17: mount Read More »

Linux common commands-16: tail

The tail command is used to display the content at the end of the file, which corresponds to the head command. When no parameter is connected, the last 10 lines of the specified file will be displayed on the screen by default. Syntax format: tail [parameter] Common parameters: Example # 默认显示tail test.txt # 显示文件的最后20行tail -n …

Linux common commands-16: tail Read More »

Linux common commands-15: head

The head command is used to display the content of the file. Similar to cat , the first 10 lines of the file are printed by default when no parameters are accepted. Syntax format: head [parameter] [file] Common parameters: Example # 默认显示head test.txt # 显示文件的前20行head -n 20 test.txt # 显示文件的前20个字符,注意和行的区别head -c 20 test.txt This article …

Linux common commands-15: head Read More »

Linux common commands-14: fdisk

fdisk is a disk partitioning tool. It can perform hard disk partition operations, such as creating, deleting, formatting, etc. Using this command requires special care, and it also requires administrator privileges. Syntax format: fdisk [parameter] Common parameters: Example # 查看所有分区情况,包括多个磁盘sudo fdisk -l # 操作某个磁盘sudo fdisk /dev/sda Enter m to view the corresponding command Common such …

Linux common commands-14: fdisk Read More »

Linux common commands-13: du

du is the abbreviation of Disk Usage , used to view the disk space. Unlike the df command, the du command looks at the disk space used by files and directories, not a partition. Syntax format: du [parameter] [file] Common parameters: Example # 显示指定文件所占空间du -sh file # 显示文件夹内所有文件大小du -sh dir # 显示文件夹内所有文件的大小du -ah dir/ This …

Linux common commands-13: du Read More »

Linux common commands-12: df

The df command is the abbreviation of disk free , which is used to display the available disk space on the system. The default display unit is KB . The parameter -h is often used. The data is easier to read and understand. Syntax format: df [parameter] [specified file] Common parameters: Example df -h # …

Linux common commands-12: df Read More »

Linux common commands-11: rmdir

The function of the rmdir command is to delete empty directories, and only empty directories can be deleted. Generally rarely used, directly use rm instead Syntax format: rmdir [parameter] [directory name] Common parameters: Example # 删除空目录dir rmdir dir # 递归删除,与rm -rf test1 作用相同rmdir -p test1/test2/test3 This article is reprinted from https://xugaoxiang.com/2022/06/03/linux-cmds-11-rmdir/ This site is for …

Linux common commands-11: rmdir Read More »

Linux common commands-5: cp

The cp command is the abbreviation of the English word copy , and its role is to copy files or directories. The cp command can copy multiple files to a specific file name or an existing directory, and can also copy multiple files to a specified directory at the same time. Syntax format: cp [parameter] …

Linux common commands-5: cp Read More »

Linux common commands-4: cat

The cat command is used to view the content of plain text files, targeting files with less content. The viewing method of large files will be introduced later. Syntax format: cat [parameter] [file] Common parameters: Example # 查看文件test.py的内容,并显示行号cat -n test.py If there is no editor in the system, you can also use cat to edit …

Linux common commands-4: cat Read More »

Linux common commands-2: mkdir

mkdir is short for make directories , used to create directories. By default, if the directory to be created already exists, it prompts that it already exists instead of continuing to create the directory. mkdir command can create multiple directories at the same time. Command format: mkdir [参数] [目录] Example: # 创建test目录mkdir test # 递归创建目录,A也是一个目录mkdir …

Linux common commands-2: mkdir Read More »

Linux common commands-1: ls

ls is the abbreviation of the English word list , and its function is to list the contents of the specified directory and its related attribute information. By default, ls lists the contents of the current directory. With parameters, we can do more with ls . Example View current directory (base) xugaoxiang@1070Ti:~$ ls -l total …

Linux common commands-1: ls Read More »