Commands on linux – How to use it on vps/server – Part 2

Back to top index ^

DEB packages (Debian, Ubuntu and similar systems)
Package.deb install/update a deb package
Package_name remove a deb package from system
Shows all objects in the system have been installed the deb package
dpkg -l | Grep httpd to display all names containing “httpd” the deb package
Package_name is already installed on your system in a special package information
Package_name displays have been installed in the system list of files from a deb package
Dpkg–contents package.deb show list of files provided by a package not yet installed
/Bin/ping verify that the documents given the deb package

Back to top index ^

Software tool APT (Debian, Ubuntu and similar systems)
Apt-get install package_name installed/updated a deb package
Install/update apt-cdrom install package_name from CD a deb package
Apt-get update updating the list of packages
Apt-get upgrade to upgrade all installed software
Apt-get remove package_name remove a deb package from system
Apt-get check verify the correct repositories depend on
Apt-get clean from the download package to clean up the cache
Apt-cache search searched-package returns the package name contains the string for which to search

Back to top index ^

To view the file contents
Cat file1 from starting with the first byte is to view the contents of a file
TAC file1 start from last row back-view the contents of a file
More the contents of File1 to view a long file
Less file1 is similar to the ‘more’ command, but it allows for and positive action in the file the same as the reverse operation
Viewing a file file1 the first two lines
File1 to view the last line of a file
/Var/log/messages real-time view is added to the contents of a file

Back to top index ^

Text processing
cat file1 file2 … | command <> file1_in.txt_or_file1_out.txt general syntax for text manipulation using PIPE, STDIN and STDOUT
cat file1 | Command(SED,grep,awk,grep,etc…)>result.txt a detailed description of the file a text, and writing the introduction to a new file
cat file1 | Command(SED,grep,awk,grep,etc…)>>result.txt a detailed description of the file a text, and writes the introduction to an existing file
/Messages look in the file ‘/var/log/messages’ keyword “Aug”
Grep ^/log/messages look in the file ‘/var/log/messages’ with “Aug” at the beginning of words
Grep [0-9]/var/log/messages select ‘/var/log/messages’ files contain all numbers in a row
/Log/* in the directory ‘/var/log’ and directory then the search string “Aug”
SED’s/stringa1/stringa2/g’ in the example.txt file example.txt “String1” replaced with “string2”
SED ‘/^$/d’ from example.txt file example.txt remove all blank lines
sed ‘/ *#/d; /^$/D’ removes all comments and whitespace from example.txt file example.txt
echo ‘esempio’ | Tr ‘[:lower:]’ ‘[:upper:]’ merge the contents of a cell
‘1d’ ruled out first line in result.txt from file example.txt
‘/Stringa1/p’ view contains only the word “String1”
‘S/*$//’ example.txt remove blank characters each line end
‘S/stringa1//g’ example.txt delete words from the document “String1” and retain all
‘1,5p;5q’ example.txt view the contents to the 5th row from the first row
‘5p;5q’ example.txt view 5th line
‘S/00*/0/g’ example.txt replaced with a single zero zero
File1, mark the file’s line number
cat example.txt | Awk example.txt file ‘NR%2==1’ delete all even-numbered rows in
echo a b c | AWK ‘{print $1}’ view a row column
echo a b c | AWK ‘{print $1,$3}’ view the first row and third column
Paste file1 file2, merge the contents of two files or two-column
‘+’ File1 file2 merge the contents of two files or two columns, separated by “+” distinction
Sort file1 file2, sorts the contents of two files
sort file1 file2 | Uniq remove the set Union of two files (duplicate rows only)
sort file1 file2 | Delete intersection, leaving other row
sort file1 file2 | Remove the intersection of two files (leaving only exists in two files in the file)
File1 file2 compare the contents of two files to delete only the contents ‘file1’
File1 file2 compare the contents of two files to delete only the contents ‘file2’
File1 file2 compare the contents of two files by deleting only two files have in common parts

Back to top index ^

Character set and file format conversion
Dos2unix filedos.txt fileunix.txt converts a text file format from MSDOS to UNIX
Unix2dos fileunix.txt filedos.txt converts a text file format from UNIX to MSDOS
recode .. HTML < page.txt > page.html converting a text file into HTML
recode -l | More displays all allow format conversion

Back to top index ^

File system analysis
/Dev/hda1 check the magnetic bad blocks on disk hda1
/Hda1 on hda1 disk repair/check integrity of the Linux file system
Fsck./hda1 hda1 disk repair/check integrity of ext2 file system on
/Hda1 hda1 disk repair/check integrity of ext2 file system on
/Dev/hda1 hda1 disk repair/check integrity of ext3 file systems on
Fsck./hda1 hda1 disk repair/check integrity of ext3 file systems on
Fsck./hda1 repair/check integrity of fat filesystems on disk hda1
Fsck./hda1 repair/check integrity of DOS filesystems on disk hda1
/Hda1 repair/check integrity of DOS filesystems on disk hda1

Back to top index ^

Initializing a file system
/Hda1 on hda1 partition to create a file system
/Hda1 created the hda1 partition a Linux ext2 file system
Hda1 partition/dev/hda1 create a Linux ext3 (Journal) filesystem
/Hda1 creates a FAT32 file system
/Dev/fd0 formatting a floppy disk
/Hda3 create a swap file system

Back to top index ^

SWAP file system
/Hda3 create a swap file system
/Hda3 enables a new swap file system
//Hdb3 enable two swap partitions

Back to top index ^

Backup
-/Home0. making a full backup of the ‘/home’ directory
-/Home0. make a list of ‘/home’ interactive backup
/Tmp/home0.bak restore an interactive backup
–/Tmp on both sides of the directory
-E SSH–ip_address:/tmp via SSH channel rsync
-E SSH–delete ip_addr:/home//local a remote directory via SSH and compression will be synchronized to a local directory
-E SSH–/local ip_addr:/home/public via SSH and compression will be local to the remote directory
dd bs=1M if=/dev/hda | gzip | SSH user@ip_addr ‘dd of=hda.gz’ via SSH on the remote host perform a backup on a local disk operation
Dd if=/dev/sda of=/TMP/file1 back up the disk contents to a file
Backup./user perform an interactive backup of ‘/home/user’ directory operations
( cd /tmp/local/ && tar c . ) | User@ip_addr ‘/share/&& tar ‘ via SSH on the remote directory replication in a directory content
( tar c /home ) | User@ip_addr ‘/backup-home && tar ‘ copy via SSH on the remote directory for a list of local
tar cf – . | (/Backup; tar xf-) local copy a directory to another location, retain original permissions and links
find /home/user1 -name ‘*.txt’ | XARGS–target-directory=/home/backup/–parents from one directory to find and copy all the files ending in ‘.txt’ to a different directory
find /var/log -name ‘*.log’ | tar cv –files-from=- | Bzip2 > log.tar.bz2 find all files ending in ‘.log’ and make an bzip packages
Dd if=/dev/hda of=/dev/fd0 BS=512 count=1 a MBR (Master Boot Record) to copy the contents to the floppy disk
Dd if=/dev/fd0 of=/dev/hda BS=512 count=1 restore the MBR from a backup has been saved to a floppy disk

Leave a Reply

Your email address will not be published. Required fields are marked *