Linux命令的英文解釋3)

來源:互聯網
上載者: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=1M if=/dev/hda | gzip | ssh user@ip_addr 'dd of=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 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 albero 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 calls made and received by a process
strace -f -e open ls >/dev/null display library calls
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

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.