Home > OS >  Linux simple instructions
Linux simple instructions

Time:10-18

Firewall

Check the firewall status
Systemctl status iptables (or service iptables status)

Close the firewall
Systemctl stop iptables (or service iptables stop)

System information

Curl ifconfig. Me to find the native public IP

The arch display processor architecture of the machine (1)
Uname -m display processor architecture of the machine (2)
Uname -r shows are using the kernel version of
Dmidecode - q display hardware system components - () fix for SMBIOS/DMI)
Hdparm incorrectly listed - I/dev/hda architectural properties of a disk
Hdparm - tT/dev/sda on the disk to perform test reads
The cat/proc/cpuinfo display CPU info information
The cat/proc/interrupts according to interrupt
Cat/proc/meminfo check memory usage
The cat/proc/swaps show which swap used
The cat/proc/version displays the version of the kernel
The cat/proc/net/dev shows the network adapter and statistical
Cat/proc/mounts display loaded file system
Lspci listed - TV PCI devices
Lsusb - TV shows USB device
The date shows system date
CAL 2007 show 2007 calendar table
Date set the date and time - 041217002007.00 month day in years. Second
Amend the time saved to the BIOS clock - w

The ps command common usage (convenient to check the system process)

1) ps a shows the current terminal under all programs, including other users' application,
2) ps - A show all processes,
3) ps listed c program, each program for instructions on the real name, and do not include the path, parameters or resident services,
4) ps - e effect of these parameters and designated "A" parameter is the same,
5) ps e listed program, each program used by environment variables,
6) ps f tree structure with ASCII characters show that the correlation between expression applications,
7) ps - H display tree structure, show the relationship between program,
8) ps - N shows all of the program, in addition to perform under the ps command terminal program,
9) ps s use of program signal format display program,
Listed 10) ps S program, including the interrupt subroutine material,
11) ps - t12) the format of the ps u is given priority to with the user to display the application situation,
13) ps x shows all the procedures, not to distinguish between terminal,

Commonly used assembly instructions

Ps aux, then use the grep command filter through the pipe to find specific process, and then the specific processes,
Ps aux | grep program_filter_word, ps - ef | grep tomcat
Ps - ef | grep Java | grep -v grep shows all of the Java process, place off the current process of grep,

Shutdown (system shutdown, restart, and logout)

Shutdown - h now shut down the system (1)
Init 0 closed system (2)
Telinit 0 closed system (3)
Shutdown - h hours: minutes & amp; According to the scheduled time closed system
Shutdown - c cancelled at predetermined time closed system
Shutdown -r now restart (1)
Reboot to restart (2)
Logout cancellation

File and directory

CD/home into the directory '/home'
'CD... Back at the next higher level directory
CD.../... Return on two level directory
CD into the personal home directory
CD ~ user1 into personal home directory
CD - returns the last directory
The PWD shows work path
Ls view files in a directory
Ls -f view files in a directory
Ls -l shows details of the file and directory
The ls - a show hidden files
Ls [0-9] that contains the number of file names and directory name
Tree display files and directories from the root directory tree structure (1)
Lstree display files and directories from the root directory tree structure (2)
Mkdir dir1-name create a directory called 'dir1-name'
The mkdir dir1-name dir2 also create two directories
Mkdir -p/TMP/dir1-name/dir2 create a directory tree
The rm -f file1 delete a file called "file1" '
Rmdir dir1-name delete a directory called 'dir1-name'
Rm - rf dir1-name delete a directory called 'dir1-name and delete its contents at the same time
Rm - rf dir1-name dir2 deleted at the same time two directories and their contents
The mv dir1-name new_dir rename/move a directory
Cp file1 file2 copy a file
Cp dir/*. Copying a directory of all the files to the current working directory
Cp - a/TMP/dir1-name. Copying a directory to the current working directory
Cp - a dir1-name dir2 copying a directory
Ln -s file1 lnk1 creates a pointer to a file or directory soft links
Ln file1 lnk1 physical links to create a pointer to a file or directory
Touch - t 0712250000 file1 modify a file or directory timestamp - (YYMMDDhhmm)
The file file1 outputs the mime type of the file as text
Iconv -l lists known coding

File search

The find/-name file1 start with '/' search for files and directories into the root file system
The find/- user user1 search belongs to the users' user1 files and directories
The find/home/user1 -name *. Bin search in the directory '/home/user1' with '. Bin at the end of the file
'The find/usr/bin -type f - atime + 100 search in the past 100 days not is used to perform the file
The find/usr/bin -type f - mtime - 10 search within 10 days is created or modified files
Find/- name *. RPM - exec chmod 755 '{}'; RPM search with the '. 'at the end of the file and define its permissions
Find/xdev - name *. RPM search with the '. The RPM 'at the end of the file, ignore drives home plate, etc. Can be mobile devices
Locate *. Looking for 'ps. Ps "at the end of the file - first run" updatedb "command
Whereis the halt displays a binary file, the location of the source or man
Which the halt to display a full path to the binary or executable file

Mount a file system

Mount/dev/hda2/MNT/hda2 mount a disc - called hda2 determine directory '/MNT/hda2 has existed
Umount/dev/hda2 unload a plate - called hda2 first from the mount point "/MNT/hda2 exit
The fuser - km/MNT/hda2 when the device is busy mandatory uninstall
Umount -n/MNT/hda2 run unload operations without written to the/etc/mtab file - when a file is read-only or is useful when the disk write 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
The mount -o loop file. The iso/MNT/cdrom mount a file or iso image file
The mount -t vfat/dev/hda5/MNT/hda5 mount a Windows FAT32 file system
Mount/dev/sda1/MNT/usbdisk mount a usb jie disk or flash memory device
Mount -t SMBFS -o username=user and password=pass//WinClient/share/MNT/share mount a Windows network share

Disk space

Df -h display the list of partition is mounted
Ls - lSr | more arranged in size file and directory
Du - sh dir1-name estimates directory 'dir1-name' use of disk space
'Du - sk * | sort - rn) based on size, in turn, according to the size of the file and directory
RPM - q - a - qf '% 10 {NAME} {SIZE} t % n' | sort - k1, 1 n based on the SIZE of the display has been installed in turn the space used by RPM package (fedora, redhat class system)
DPKG - query - W - f='Installed? The Size; 10 t {Installed - Size; 10} tInstalled? The Size; 10 t {Package} n '| sort - k1, 1 n based on the size of the display installed deb Package used by space (ubuntu, debian system)

Users and groups

Groupadd group_name to create a new user group
Groupdel group_name delete a user group
Groupmod -n new_group_name old_group_name rename a user group
Useradd - c "Name Surname" admin - d - g/home/user1 -s/bin/bash user1 create a user belonging to the "admin" user group
Useradd user1 create a new user
Userdel -r user1 delete a user (' -r 'exclude home directory)
Usermod - c "User FTP" system - d - g/FTP/user1 -s/bin/nologin user1 modify User attribute
Passwd change password
Passwd user1 to modify a user's password (only allows root to perform)
Chage - 2005-12-31 E user1 set a deadline for the failure of user password
PWCK check of the/etc/passwd file format and grammar corrections and existing user
GRPCK check of the/etc/passwd file format and grammar corrections and existing group
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related