Getting Started with Linux Commands: Other Important Commands Using Basic Tutorial

  

◆ Installation and Login: login, shutdown, halt, reboot, install, mount, umount, chsh, exit, last

◆ File Processing: file, Mkdir, grep, dd, find, mv, ls, diff, cat, ln

◆ System Management: df, top, free, quota, at, lp, adduser, groupadd, kill, crontab

◆ Network operation: ifconfig, ip, ping, netstat, telnet, ftp, route, rlogin, rcp, finger, mail, nslookup

◆ System security: passwd, su, umask, chgrp, chmod, chown , chattr, sudo ps, who

◆ Other commands: tar, unzip, gunzip, unarj, mtools, man, unendcode, uudecode

—————— & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; tar

1. tar command role is Unix /Linux system in a reliable way to back up files, can work in almost any environment, it Usage rights for all users.

2. Format tar [main option + sub-option] file or directory

3. Main parameters When using this command, the main option is mandatory, it tells tar what to do The auxiliary option is auxiliary and can be used.

Main option: -c Create a new archive file. If the user wants to back up a directory or some files, choose this option.

-r Append the file to be archived to the end of the archive. For example, if the user has already made a backup file and finds that there is still a directory or some files forgotten to back up, you can use this option to append the forgotten directory or file to the backup file. -t Lists the contents of the archive and sees which files have been backed up. -u Update the file. That is to say, the original backup file is replaced with the newly added file, and if the file to be updated is not found in the backup file, it is appended to the end of the backup file. -x released files from the archive.

Auxiliary Options: -b This option is set for the tape drive, followed by a number to indicate the size of the block. The system default is 20 (20× 512 bytes). Use -f archive file or device, this option is usually mandatory. -k Saves an existing file. For example, if you restore a file and encounter the same file during the restore process, it will not be overwritten. -m Sets the modification time of all files to the current when restoring files. -M Creates a multi-volume archive for storage on several disks. -v Detailed report of file information processed by tar. If you do not have this option, tar does not report file information. -w Confirmation is required at each step. -z Use gzip to compress/decompress files. After adding this option, you can compress the archive file, but you must use this option to decompress it when restoring.

4. Application Note tar is an abbreviation for Tape Archive, originally designed to package files onto tape. If you have downloaded the source code of Linux, you may have encountered a tar file.

Please note that Linux is not case sensitive. For example, the tar command should always be executed in lowercase. Command line switches can be a mixture of uppercase, lowercase, or uppercase. For example, -t and -T perform different functions. File or directory name can be mixed case, but as the same commands and command-line switches are case sensitive.

5. Application tar is a command line tool with no graphical interface. Use Konsole to open a terminal window, followed by a simple backup command (create a back.tar file in the /temp directory, including everything in the /usr directory.): $tar cvf – /usr > ; /temp/back.tar

In addition, the tar command supports the crontab command described in the third lecture above, which can be set to run regularly based on time using the crontab tool. For example, back up the /usr directory to hda&mdash at 6 o'clock every night; the main drive of the first IDE interface (always on the first hard drive), just add the following statement to the root crontab: $00 06 * * * tar cvf /dev/hda1/usrfiles.tar – /usr

In general, the following directories need to be backed up: ◆/etc contains all core configuration files, including network configuration, system name, Firewall rules, users, groups, and other global system items. ◆ /var Contains information used by the system daemon (service), including DNS configuration, DHCP lease, mail buffer file, HTTP server file, dB2 instance configuration, and more. ◆ /home contains the home directory of all default users, including personal settings, downloaded files, and other information that the user does not want to lose. ◆ /root root (root) user's home directory. ◆ /opt is where many non-system files are installed. IBM software is installed here. OpenOffice, JDK, and other software are also installed here by default.

Some directories can be backed up: ◆ /proc should never back up this directory. It's not a real file system, it's a virtualized view of the kernel and environment, including files like /proc/kcore, which is a virtual view of the entire running memory. Back up these files are just a waste of resources. ◆ /dev contains a file representation of the hardware device. If you plan to restore to a blank system, you can back up /dev. However, if you plan to restore to an installed Linux system, then backing up /dev is not necessary.

& mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; —————————unzip

1. The unzip commands are located in the /usr/bin directory, and they are pkzip, pkunzip, and MS under MS DOS. u> The Winzip software in Windows
has the same function, compressing the file into a .zip file to save hard disk space, and then uncompressing the compressed file with the unzip command when needed. The command usage permission is for all users.

2. Format unzip [-cflptuvz][-agCjLMnoqsVX][-P <password>][.zip file][file][-d <directory>][-x <file >]

3. Main parameter -c: Display the decompressed result to the screen and make appropriate conversions to the characters. -f: Update existing files. -l: Display the files contained in the compressed file. -p: Similar to the -c parameter, the decompressed result is displayed on the screen, but no conversion is performed. -t: Check if the compressed file is correct. -u: Similar to the -f parameter, but in addition to updating existing files, other files in the compressed file are also extracted into the directory. -v: Displays detailed information when executed. -z: Displays only the comment text of the compressed file. -a: Perform the necessary character conversion on the text file. -b: Do not perform character conversion on text files. -C: The file name in the compressed file is case sensitive. -j: Does not process the original directory path in the compressed file. -L: Change all file names in the compressed file to lowercase. -M: Send the output to the more program. -n: Do not overwrite the original file when decompressed. -o: You don't have to ask the user first, and unzip the original file after execution. -P<Password>: Use the zip password option. -q: No information is displayed during execution. -s: Converts whitespace characters in the file name to bottom-line characters. -V: Retains the file version information of the VMS. -X: Restores the original UID/GID of the file at the same time when decompressing. [.zip file]: Specify a .zip file. [File]: Specify which files in the .zip archive to process. -d<directory>: Specifies the directory to be stored after the file is unzipped. -x<file>: Specifies which files in the .zip archive are not processed. -Z unzip: -Z is equivalent to executing the zipinfo command. In Linux, a tool called zipinfo is also provided to view the details of the zip archive. The latest version of unzip is 5.50.

& mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; —————————gunzip

1. The function of the gunzip command is to extract the file, and the usage rights are all users.

2. Format gunzip [-acfhlLnNqrtvV][-s <compressed suffix string>][file...] or gunzip [-acfhlLnNqrtvV][-s <compressed suffix string> ;][Directory]

3. Main parameters -a or – ascii: Use ASCII text mode. -c or –stdout or –to-stdout: Output the decompressed file to the standard output device. -f or -force: Forcibly unzip the compressed file, regardless of whether the file name or hard link exists and whether the file is a symbolic link. -h or –help: online help. -l or –list: Lists information about compressed files. -L or –license: Display version and copyright information. -n or –no-name: When decompressing, if the compressed file contains the original file name and timestamp, it will be ignored and will not be processed. -N or –name: When decompressing, if the compressed file contains the original file name and timestamp, it will be saved back to the unpacked file. -q or –quiet: No warning message is displayed. -r or –recursive: Recursive processing, all files and subdirectories under the specified directory are processed together. -S & lt; compressed suffix string & gt; or & ndash; suffix & lt; & gt ;: compressed suffix string change the compression suffix string. -t or –test: Tests if the compressed file is correct. or -v & ndash; verbose: display instruction execution. -V or & ndash; version: Displays the version information. .

4 described gunzip is widely used decompressor, which is used to unlock gzip compressed file, the compressed file preset final extension & ldquo; .gz & rdquo ;. In fact, gzip gunzip is hardwired, so whether compression or decompression, can be done solely by gzip command. The latest version of gunzip is 1.3.3.

& mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; —————————

Copyright © Windows knowledge All Rights Reserved