Home  >  Article  >  Operation and Maintenance  >  Linux must-learn commands

Linux must-learn commands

silencement
silencementOriginal
2019-06-13 13:18:2710071browse

Linux must-learn commands

Common Linux commands include

System information

arch Display 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 displays the hardware system components - (SMBIOS / DMI)
hdparm - i /dev/hda Lists the architectural features of a disk
hdparm -tT /dev/sda Performs test read operations on the disk
cat /proc/cpuinfo Displays CPU info information
cat /proc/ interrupts Display interrupts
cat /proc/meminfo Verify memory usage
cat /proc/swaps Display which swaps are used
cat /proc/version Display the kernel version
cat /proc/net/dev Display network adapters and statistics
cat /proc/mounts Display mounted file systems
lspci -tv List PCI devices
lsusb -tv Display USB devices
date Display system date
cal 2007 display Calendar 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 Log out)

shutdown -h now Shut down 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 according to the scheduled time
shutdown -c Cancel the system shutdown according to the scheduled time
shutdown -r now Restart (1)
reboot Restart (2)
logout Logout

Files and directories

cd /home Enter the '/ home' directory'
cd .. Return to the previous directory
cd ../.. Return to the upper two-level directory
cd Enter the personal home directory
cd ~user1 Enter the personal home directory
cd - Return to the last directory
pwd Display the working path
ls View files in the directory
ls -F View files in the directory
ls -l Display details of files and directories
ls -a Display hidden files
ls *[0-9] * Display file names and directory names containing numbers
tree Display the tree structure of files and directories starting from the root directory (1)
lstree Display the tree structure of files and directories starting from the root directory (2)
mkdir dir1 creates a directory called 'dir1'
mkdir dir1 dir2 creates two directories at the same time
mkdir -p /tmp/dir1/dir2 creates a directory tree
rm -f file1 deletes a directory called 'file1 'File'
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 at the same time Directories and their contents
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 Create a soft link pointing to a file or directory
ln file1 lnk1 Create a link pointing to 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 List known encoding

The above is the detailed content of Linux must-learn commands. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn