Linux Command 3)

Source: Internet
Author: User
Linux commands line V1.0-linuxguide. it
Format a filesystem
Mkfs/dev/hda1 create a filesystem type Linux on hda1 Partition
Mke2fs/dev/hda1 create a filesystem type Linux ext2 on hda1 Partition
Mke2fs-J/dev/hda1 create a filesystem type Linux ext3 (Journal) on hda1 Partition
Mkfs-T vfat 32-F/dev/hda1 create a FAT32 filesystem
Fdformat-N/dev/fd0 format a floppy disk
Mkswap/dev/hda3 create a swap filesystem
Linux commands line V1.0-linuxguide. it
Swap filesystem
Mkswap/dev/hda3 create a swap filesystem
Swapon/dev/hda3 activating a new swap Partition
Swapon/dev/hda2/dev/HDB3 activate two swap partitions
Linux commands line V1.0-linuxguide. it
Backup
Dump-0aj-F/tmp/home0.bak/home make a full backup of directory '/home'
Dump-1aj-F/tmp/home0.bak/home make a Incremental backup of directory '/home'
Restore-If/tmp/home0.bak restoring a backup interactively
Rsync-rogpav -- delete/home/tmp synchronization between Directories
Rsync-rogpav-e SSH -- delete/home ip_address:/tmp rsync via SSH Tunnel
Rsync-Az-e SSH -- delete ip_addr:/home/public/home/local synchronize a local directory with a remote directory via SSH and Compression
Rsync-Az-e SSH -- delete/home/local ip_addr:/home/Public synchronize a remote directory with a local directory via SSH and Compression
Dd BS = 1 m if =/dev/hda | gzip | SSH user @ ip_addr 'dd of1_hda.gz 'make a backup of a local hard disk on remote host via SSH
Tar-puf backup.tar/home/user make a Incremental backup of directory '/home/user'
(CD/tmp/local/& tar C .) | ssh-C user @ ip_addr 'CD/home/share/& tar X-p' copy content of a directory on remote directory via SSH
(Tar c/Home) | ssh-C user @ ip_addr 'CD/home/backup-Home & tar X-p' copy a local directory on remote directory via SSH
Tar CF-. | (CD/tmp/backup; tar xf-) local copy preserving permits and links from a directory to another
Find/home/user1-name '*. TXT '| xargs CP-Av -- target-directory =/home/backup/-- parents find and copy all files with '.txt' extention from a directory to another
Find/var/log-name '*. log' | tar cv -- files-from =-| Bzip2> log.tar.bz2 find all files with'. log' Extention and make an bzip Archive
Dd If =/dev/hda of =/dev/fd0 BS = 512 COUNT = 1 make a copy of MBR (Master Boot Record) to floppy
Dd If =/dev/fd0 of =/dev/hda BS = 512 COUNT = 1 restore MBR from backup copy saved to floppy
Linux commands line V1.0-linuxguide. it
CDROM
Cdrecord-V gracetime = 2 Dev =/dev/CDROM-eject blank = fast-force clean a Rewritable CDROM
Mkisofs/dev/CDROM> Cd. ISO create an ISO image of CDROM on disk
Mkisofs/dev/CDROM | gzip> cd_iso.gz create a compressed ISO image of CDROM on disk
Mkisofs-J-allow-leading-dots-r-V "label cd"-iso-Level 4-o./CD. ISO data_cd create an ISO image of a directory
Cdrecord-V Dev =/dev/cdrom cd. ISO burn an ISO Image
Gzip-DC cd_iso.gz | cdrecord Dev =/dev/CDROM-burn a compressed ISO Image
Mount-o loop CD. ISO/mnt/ISO mount an ISO Image
CD-paranoia-B rip audio tracks from a CD to WAV Files
CD-paranoia -- "-3" Rip first three audio tracks from a CD to WAV Files
Cdrecord -- scanbus scan Bus to identify the channel SCSI
Linux commands line V1.0-linuxguide. it
Networking-lan and WiFi
Ifconfig eth0 show configuration of an Ethernet network card
IFUP eth0 activate an interface 'eth0'
Ifdown eth0 disable an interface 'eth0'
Ifconfig eth0 192.168.1.1 netmask 255.255.255.0 configure IP Address
Ifconfig eth0 promisc configure 'eth0' in promiscuous mode to gather packets (SNIFFING)
Dhclient eth0 active interface 'eth0' in DHCP Mode
Route-n show routing table
Route add-net 0/0 GW ip_gateway configura Default Gateway
Route add-net 192.168.0.0 netmask 255.255.0.0 GW 192.168.1.1 configure static route to reach network '192. 168.0.0/16'
Route del 0/0 GW ip_gateway remove static route
Echo "1">/proc/sys/NET/IPv4/ip_forward activate IP routing
Hostname show hostname
Host www. linuxguide. It lookup hostname to resolve name to IP address and viceversa
IP link show link status of all interfaces
MII-tool eth0 Show Link Status of 'eth0'
Ethtool eth0 show statistics of network card 'eth0'
Netstat-Tup show all active network connections and Their PID
Netstat-tupl show all network services listening on the system and their PID
Tcpdump TCP port 80 show all HTTP traffic
Iwlist scan show Wireless Networks
Iwconfig eth1 show configuration of a wireless network card
Linux commands line V1.0-linuxguide. it
Microsoft Windows networks-samba
Nbtscan ip_addr NetBIOS name resolution
Nmblookup-A ip_addr NetBIOS name resolution
Smbclient-l ip_addr/hostname show remote shares of a Windows Host
Smbget-rr SMB: // ip_addr/share like wget can download files from a host windows via SMB
Mount-T smbfs-O username = user, password = pass // winclient/share/mnt/share mount a Windows Network Share
Linux commands line V1.0-linuxguide. it
Iptables-Firewall
Iptables-T filter-l show all chains of filtering table
Iptables-T nat-l show all chains of NAT table
Iptables-T filter-F clear all rules from filtering table
Iptables-T nat-F clear all rules from Table Nat
Iptables-T filter-x delete any chains created by user
Iptables-T filter-A input-p tcp -- dport telnet-J accept allow Telnet connections to input
Iptables-T filter-A output-p tcp -- dport http-J Drop block HTTP connections to output
Iptables-T filter-a forward-p tcp -- dport POP3-J accept allow POP3 connections to forward chain
Iptables-T filter-A input-J log -- log-prefix "Drop input" logging sulla chain di input logging on chain Input
Iptables-T Nat-A postrouting-O eth0-J masquerade configure a pat (port address traslation) on eth0 masking outbound packets
Iptables-T Nat-A prerouting-D 192.168.0.1-p tcp-m tcp -- dport 22-j dnat -- to-destination 10.0.0.2: 22 redirect Packets addressed to a host to another host
Linux commands line V1.0-linuxguide. it
Monitoring and debugging
Top display Linux tasks using most CPU
PS-eafw displays Linux tasks
PS-e-o PID, argS -- forest displays Linux tasks in a hierarchical mode
Pstree mostra UN Albert o dei processi Sistema shows a tree System Processes
Kill-9 id_processo force closure of the process and finish it
Kill-1 id_processo force a process to reload Configuration
Lsof-p $ display a list of files opened by processes
Lsof/home/user1 displays a list of open files in a given path system
Strace-C ls>/dev/null Display System callmade and stored ed by a process
Strace-f-e Open ls>/dev/null Display Library CILS
Watch-N1 'cat/proc/interrupts' display interrupts in Real-Time
Last reboot show history reboot
Lsmod display kernel loaded
Free-M Displays status of RAM in megabytes
Smartctl-A/dev/hda monitoring reliability of a hard-disk through smart
Smartctl-I/dev/hda check if smart is active on a hard-disk
Tail/var/log/dmesg show events inherent to the process of booting Kernel
Tail/var/log/messages Show System Events
Linux commands line V1.0-linuxguide. it
Other useful commands
Mkbootdisk -- device/dev/fd0 'uname-R' create a boot floppy
GPG-C file1 encrypt a file with GNU Privacy Guard
GPG file1.gpg decrypt a file with GNU Privacy Guard
Wget-r www.example.com download an entire web site
Wget-C www.example.com/file.iso download a file with the ability to stop the download and resume later
Echo 'wget-C www.example.com/files.iso' | at 09:00 start a download at any given time
Ldd ssh show shared libraries required by SSH Program
Alias HH = 'History 'set an alias for a command-HH = history

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.