Recently I have used Linux in the project, and then I only use the simple ones, but I find the ones that are used in the head, so I checked
Linux commonly used commands, and used them more.
system message
arch displays the processor architecture of the machine(1)
uname -m displays the processor architecture of the machine(2)
uname -r displays the kernel version being used
dmidecode -q Display hardware system components-(SMBIOS / DMI)
hdparm -i /dev/hda lists the architectural features of a disk
hdparm -tT /dev/sda performs a test read operation on the disk
cat /proc/cpuinfo displays CPU info information
cat /proc/interrupts shows interrupts
cat /proc/meminfo verify memory usage
cat /proc/swaps shows which swap is used
cat /proc/version shows the version of the kernel
cat /proc/net/dev displays network adapters and statistics
cat /proc/mounts shows the mounted file system
lspci -tv lists PCI devices
lsusb -tv display USB devices
date display system date
cal 2007 displays the calendar table for 2007
date 041217002007.00 Set date and time-month day hour minute year. second
clock -w save time modification to BIOS
Shutdown (system shutdown, restart and logout)
shutdown -h now shutdown the system (1)
init 0 shut down the system (2)
telinit 0 Shut down the system (3)
shutdown -h hours:minutes & shut down the system at the scheduled time
shutdown -c Cancel to shut down the system as scheduled
shutdown -r now restart (1)
reboot reboot (2)
logout
Files and directories
cd /home to enter the'/home' directory'
cd .. Return to the previous directory
cd ../.. Return to the upper two-level directory
cd into the personal home directory
cd ~user1 to enter the personal home directory
cd-return to the last directory
pwd display working path
ls View files in the directory
ls -F View files in the directory
ls -l displays detailed information about files and directories
ls -a show hidden files
ls *[0-9]* Display file names and directory names containing numbers
tree displays the tree structure of files and directories starting from the root directory (1)
lstree displays the tree structure of files and directories starting from the root directory (2)
mkdir dir1 creates a directory called'dir1'
mkdir dir1 dir2 create two directories at the same time
mkdir -p /tmp/dir1/dir2 creates a directory tree
rm -f file1 delete a file called'file1'
rmdir dir1 delete a directory called'dir1'
rm -rf dir1 delete a directory called'dir1' and delete its contents at the same time
rm -rf dir1 dir2 delete two directories and their contents at the same time
mv dir1 new_dir rename/move a directory
cp file1 file2 copy a file
cp dir/*. Copy all files in a directory to the current working directory
cp -a /tmp/dir1. Copy a directory to the current working directory
cp -a dir1 dir2 copy a directory
ln -s file1 lnk1 creates a soft link to a file or directory
ln file1 lnk1 creates a physical link to a file or directory
touch -t 0712250000 file1 Modify the timestamp of a file or directory-(YYMMDDhhmm)
file file1 outputs the mime type of the file as text
iconv -l lists known codes
iconv -f fromEncoding -t toEncoding inputFile> outputFile creates a new from the given input file by assuming it is encoded in fromEncoding and converting it to toEncoding.
find. -maxdepth 1 -name *.jpg -print -exec convert "{}" -resize 80x60 "thumbs/{}" \; batch resize files in the current directory and send them to a thumbnails directory (requires convert from Imagemagick)
File search
find / -name file1 Enter the root file system to search for files and directories starting from'/'
find / -user user1 search for files and directories belonging to user'user1'
find /home/user1 -name \*.bin Search for files ending with'.bin' in the directory'/ home/user1'
find /usr/bin -type f -atime +100 Search for executable files that have not been used in the past 100 days
find /usr/bin -type f -mtime -10 Search for files created or modified within 10 days
find / -name \*.rpm -exec chmod 755'{}' \; Search for files ending with'.rpm' and define their permissions
find / -xdev -name \*.rpm Search for files ending with'.rpm', ignoring removable devices such as CD-ROM drives and Czech disks
locate \*.ps find files ending with'.ps'-run the'updatedb' command first
whereis halt shows the location of a binary file, source code or man
which halt displays the full path of a binary file or executable file
Mount a file system
mount /dev/hda2 /mnt/hda2 mount a disk called hda2-make sure the directory'/ mnt/hda2' already exists
umount /dev/hda2 Unmount a disk called hda2-first exit from the mount point'/mnt/hda2'
fuser -km /mnt/hda2 Force uninstall when the device is busy
umount -n /mnt/hda2 runs the uninstall operation without writing to the /etc/mtab file-useful when the file is read-only or when the disk is full
mount /dev/fd0 /mnt/floppy mount a floppy disk
mount /dev/cdrom /mnt/cdrom mount a cdrom or dvdrom
mount /dev/hdc /mnt/cdrecorder mount a cdrw or dvdrom
mount /dev/hdb /mnt/cdrecorder mount a cdrw or dvdrom
mount -o loop file.iso /mnt/cdrom mount a file or ISO image file
mount -t vfat /dev/hda5 /mnt/hda5 mount a Windows FAT32 file system
mount /dev/sda1 /mnt/usbdisk mount a USB shortcut or flash device
mount -t smbfs -o username=user,password=pass //WinClient/share /mnt/share mount a windows network share
disk space
df -h displays a list of mounted partitions
ls -lSr |more arrange files and directories by size
du -sh dir1 Estimate the disk space used by the directory'dir1'
du -sk * | sort -rn displays the size of files and directories in order based on the size
rpm -q -a --qf'%10{SIZE}t%{NAME}n' | sort -k1,1n Display the space used by installed rpm packages in order based on size (fedora, redhat system)
dpkg-query -W -f='${Installed-Size;10}t${Package}n' | sort -k1,1n Display the space used by installed deb packages based on size (ubuntu, debian system )