1.1. Turn off the machine
Shutdown-h Now shutting down the system (1)
Init 0 shutting down the system (2)
Telinit 0 shutting down the system (3)
shutdown-h Hours:minutes & shut down the system at a predetermined time
shutdown-c Cancel to shut down the system at a predetermined time
Shutdown-r Now Restart (1)
reboot Restart (2)
Logout Logout
1.2. Disk space
df-h to display a list of partitions that have been mounted
LS-LSR |more arrange files and directories in size
Du-sh Dir1 Estimate Catalog ' Dir1 ' disk space already in use '
Du-sk * | Sort-rn displays the size of the files and directories, in turn, based on capacity size
1.3. Files and directories
Cd/home Enter '/home ' Catalogue '
CD.. return to the top level directory
CD.. /.. return to the top level two directory
CD go to your personal home directory
CD ~user1 go to your personal home directory
CD- return to the last directory where
pwd Show work Path
ls viewing files in a directory
ls-f view the files in the directory, with a character appended to each file name to indicate the type of the file, " * "represents an executable plain file;" / "indicates the directory;" @ "denotes symbolic links;" | "represents FIFOs ; " = "represents a socket (sockets) .
ls-l display details of files and directories
ls-a Show hidden files
ls *[0-9]* display filenames and directory names that contain numbers
mkdir Dir1 Create a call ' Dir1 ' the directory '
mkdir dir1 Dir2 Create two directories at a time
mkdir-p/tmp/dir1/dir2 Create a directory tree
rm-f file1 Delete a call ' File1 ' of the file '
rmdir Dir1 Delete a call ' Dir1 ' the directory '
RM-RF Dir1 Delete a call ' Dir1 ' directory 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 Renaming / Moving a directory
CP file1 File2 Copy a file
CP dir/*. Copy all files under 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 to a file or directory
LN file1 lnk1 Create a physical link to a file or directory
touch-t 0712250000 file1 Modify the timestamp of a file or directory -(YYMMDDHHMM)
file File1 Document Identification file1 of the type.
1.4. File Search
Find/-name file1 from '/' start the root file system to search for files and directories
Find/-user user1 search belongs to user ' user1 ' the files and directories
find/home/user1-name \*.bin in the catalog '/home/user1 ' in search with '. bin ' End of File
find/usr/bin-type f-atime +100 search in the past - files that have not been used in the day
Find/usr/bin-type f-mtime-10 Search in Ten files created or modified within the day
Find/-name \*.rpm-exec chmod 755 ' {} '; Search to '. RPM ' end of the file and define its permissions
Find/-xdev-name \*.rpm Search to '. RPM ' the end of the file, ignoring the optical drive, Czech disk and other removable devices
Locate \*.ps looking to '. ps ' End of File - Run First ' UpdateDB ' Command
Whereis Halt displays a binary file, source code, or Mans the location
which halt displays the full path of a binary file or executable file
1.5. Permissions for files
Use "+" set permissions, using "-" used to cancel
LS-LH Show Permissions
ls/tmp | pr-t5-w$columns divide the terminal into 5 Bar Display
chmod ugo+rwx directory1 Everyone who sets the directory (U) , Groups (g) and other people (o) to read ( R ), write (W) and Implementation (x) the Permissions
chmod go-rwx directory1 Delete a group (g) Other than others (o) Read and write execution permissions on the directory
chown user1 file1 change the Owner property of a file
chown-r user1 Directory1 change the Owner property of a directory and change the properties of all files in the directory at the same time
chgrp group1 file1 groups that change files
chown user1:group1 file1 Change the owner and group properties of a file
1.6. View the contents of a file
Cat File1 forward viewing the contents of a file starting from the first byte
TAC File1 Reverse View the contents of a file starting from the last line
More file1 View the contents of a long file
Less file1 similar to ' More ' command, but it allows the same reverse operation in the file as in the forward operation
head-2 file1 View the first two lines of a file
tail-2 file1 view the last two lines of a file
tail-f/var/log/messages view content that is added to a file in real time
1.7. Packaging and compressing files
bunzip2 file1.bz2 Unzip a called ' file1.bz2 ' of the file
bzip2 file1 Compress a called ' File1 ' of the file
gunzip file1.gz Unzip a called ' file1.gz ' of the file
gzip File1 Compress a called ' File1 ' of the file
gzip-9 file1 Maximum compression
TAR-CVF Archive.tar file1 creates a non-compressed Tar Package
tar-cvf archive.tar file1 file2 dir1 Create a containing ' file1 ', ' file2 ' as well ' Dir1 ' the archive file
TAR-TF Archive.tar Display the contents of a package
TAR-XVF Archive.tar Release a package
TAR-XVF archive.tar-c/tmp release the compressed package to / tmp directory under
tar-cvfj archive.tar.bz2 Dir1 Create a bzip2 format of the compressed package
TAR-XVFJ archive.tar.bz2 Unzip a bzip2 format of the compressed package
TAR-CVFZ archive.tar.gz Dir1 Create a gzip format of the compressed package
TAR-XVFZ archive.tar.gz Unzip a gzip format of the compressed package
zip file1.zip file1 Create a Zip format of the compressed package
zip-r file1.zip file1 file2 dir1 compress several files and directories into one Zip format of the compressed package
Unzip File1.zip Unzip a Zip Format Compression Package
1.8. RPM Package
RPM-IVH package.rpm Install a rpm Package
RPM-IVH--nodeps package.rpm Install a rpm package and ignore dependency warnings
rpm-u package.rpm Update a rpm Package But do not change its configuration file
rpm-e package_name.rpm Delete a rpm Package
Rpm-qa displays all installed in the system rpm Package
Rpm-qa | grep httpd Show all names that contain "httpd" Words of rpm Package
Rpm-qi package_name get special information for an installed package
RPM-QL package_name displays an already installed rpm list of files provided by the package
RPM-QC package_name displays an already installed rpm List of configuration files provided by the package
rpm-q package_name--whatrequires display with a rpm a list of dependencies for a package
rpm-q package_name--changelog displays a rpm modification History of the package
rpm-qf/etc/httpd/conf/httpd.conf Verify that the given file is by which rpm provided by the package
1.9. mount a file system
mount/dev/hda2/mnt/hda2 To mount a call hda2 the disk - Determine the directory '/mnt/hda2 ' already exists
umount/dev/hda2 Uninstall a call hda2 the disk - from the mount point first '/mnt/hda2 ' Exit
fuser-km/mnt/hda2 Force Uninstall when the device is busy
umount-n/mnt/hda2 run an unload operation without writing /etc/mtab file - useful when a file is read-only or when a 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 Czech disk or flash memory device
mount-t smbfs-o username=user,password=pass//winclient/share/mnt/share mount a Windows Network Sharing
1.10. File System Analysis
badblocks-v/dev/hda1 Check Disk hda1 the bad magnetic blocks on the
fsck/dev/hda1 Fix / Check hda1 on disk Linux integrity of the file system
fsck.ext2/dev/hda1 Fix / Check hda1 on disk ext2 integrity of the file system
fsck.ext3/dev/hda1 Fix / Check hda1 on disk ext3 integrity of the file system
fsck.vfat/dev/hda1 Fix / Check hda1 on disk Fat integrity of the file system
fsck.msdos/dev/hda1 Fix / Check hda1 on disk dos integrity of the file system
2. Expand command Exercise 2.1. System Information
Arch Display the processor architecture of the machine (1)
uname-m Display the processor architecture of the machine (2)
Uname-r to display the kernel version being used
Cat/proc/cpuinfo Show CPU Info of Information
cat/proc/interrupts Show Interrupts
Cat/proc/meminfo Verifying memory usage
Cat/proc/swaps Show which Swap be used
cat/proc/version Display the kernel version
Cat/proc/net/dev Display network adapters and statistics
cat/proc/mounts displaying the loaded file system
Date Show system Date
Cal Show the Calendar Table of the year
Date 041217002007.00 set the date and time - months and days of the year . seconds
clock-w save time changes to BIOS
fdisk-l viewing system partition information
Fdisk/dev/sdb for a new piece of SCSI partition the hard disk
2.2. Users and Groups
Groupadd group_name 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 " Notes "-G admin-d/home/user1-s/bin/bash user1 Create one that belongs to "Admin" Users of the user group
Useradd user1 Create a new user
Userdel-r user1 Delete a user ('-R ' at the same time delete the user's home directory )
usermod-c "User FTP"-G system-d/ftp/user1-s/bin/nologin user1 Modify User Properties
passwd Change Password
passwd user1 Modify a user's password ( root only allowed )
chage-e 2009-12-31 user1 set the expiration period for user passwords
ID User name Check user Information
2.3. Text Processing
paste File1 file2 Merge to display two files or two columns of content
paste-d ' + ' file1 file2 merge two files or two columns of content, intermediate with "+" differentiate
sort file1 file2 sort the contents of a two file
sort file1 file2 | Uniq Remove the set of two files ( Duplicate lines retain only one copy )
sort file1 file2 | uniq-u Delete the intersection and leave the other rows
sort file1 file2 | uniq-d Remove the intersection of two files ( leave only content that exists in two files at a time )
comm-1 file1 file2 Compare the contents of two files only delete ' File1 ' What's included
comm-2 file1 file2 Compare the contents of two files only delete ' File2 ' What's included
comm-3 file1 file2 Compare the contents of two files delete only two files that are common to each other
diff file1 file2 > Patch Name . Patch generate patch files for old and new files
diff file1 File2 compare the differences between two files
2.4. Character setting and file format conversion
Dos2unix filedos.txt fileunix.txt formats a text file from the MSDOS converted into UNIX
Unix2dos fileunix.txt filedos.txt formats a text file from the UNIX converted into MSDOS
VI Dos.txt
: Set Fileformat=unix
: Wq
2.5. Initializing a file system
mkfs/dev/hda1 in the hda1 partition to create a file system
mke2fs/dev/hda1 in the hda1 partition to create a Linux ext2 the file system
mke2fs-j/dev/hda1 in the hda1 partition to create a linux ext3 ( log type ) the file system
mkfs-t vfat 32-f/dev/hda1 Create a FAT32 File System
fdformat-n/dev/fd0 format a floppy disk
Mkswap/dev/hda3 Create a Swap File System
2.6. Printing
Redhat-config-printer-tui go to install printer interface
LP – d hptr File Print file to the hptr on the printer
lpq – P Printer Name to view the status of a printer
LPRM – P Printer Name a Delete a print job inside a printer
Disable – R " changing paper " hptr Disable printer and prompt for cause
Enable Hptr re-enable disabled
Linux common commands 1 "go"