Professional Documents
Culture Documents
Top Linux Shell Command
Top Linux Shell Command
WowUbuntu / Isspy
B Linux Shell
Top Ten One-Liners from CommandLineFu Explained
: boypt / isspy / riku / riku
: 2010 9 10
:CC 2.5
Isspy Wow! Ubuntu
B Linux Shell
WowUbuntu / Isspy
: http://wowubuntu.com/tag/linuxshell
ShellUnix
""Shell
B Linux Shell
WowUbuntu / Isspy
=== ===
1.SUDO
$ sudo !!
sudo
sudo
sudoCtrl-pCtrl-asudo
sudo !!
bashevent designators!!
!-1!-2!-50bash
~/.bash_history500history
The Definitive Guide to Bash Command Line
History
2.HTTP
$ python -m SimpleHTTPServer
PythonSimpleHTTPServerPythonLinux
8000HTTP
ttp://ip:8000
3.VIMROOT
:w !sudo tee %
B Linux Shell
WowUbuntu / Isspy
sudovim/etc
vim
sudo cpvim
vim:help :w:w!{cmd}vim{cmd}
stdin
teestdin
%vim
vim
4.
$ cd -
cd -cd $OLDPWDbash$OLDPWD
$PWDshell
5.
$ ^foo^bar^
event designatorfoo
bar
B Linux Shell
WowUbuntu / Isspy
!!:s/foo/bar/
!!vimsed
B Linux Shell
WowUbuntu / Isspy
8.LINUX
$ ffmpeg -f x11grab -s wxga -r 25 -i :0.0 -sameq /tmp/out.mpg
3D
ffmpegX11
ffmpeg
-f x11grab x11
ffmpeg
-s wxga wxga1366*768-s
800600
-r 25
-i :0.0 X0.0
-sameq
ffmpeg
How to Extract Audio Tracks from YouTube Videos
Converting YouTube Flash Videos to a Better Format with ffmpeg
=== ===
1.
command <CTRL-x CTRL-e>
B Linux Shell
WowUbuntu / Isspy
:>file.txt:bash
$touch file.txttouch
3.SSH
ssh -N -L2001:remotehost:80 user@somemachine
20012001somemachine
remotehost80
3
somemachinelocalhost
IP
80ssh
------ Twitter: @isspy
B Linux Shell
WowUbuntu / Isspy
webIP
4.
reset
cat
reset
resetBusyBoxreset
printf(\033c\033(K\033[J\033[0m\033[?25h);
Shell
\033c: ESC c ;
\033(K: ESC ( K ;
\033[J: ESC [ J ;
\033[0m: ESC [ 0 m ;
\033[?25h: ESC [ ? 25 h ;
5.
echo cmd | at midnight
------ Twitter: @isspy
B Linux Shell
WowUbuntu / Isspy
atcronatcron
ddifofstdin/stdout
dd if=/dev/dsp of=/dev/dsp
alsaarecordaplay:
arecord | ssh username@host aplay
arecord | aplay
B Linux Shell
WowUbuntu / Isspy
fstab
/dev/shm
FirefoxFF
ShellextmpfsFirefox tmpfs Firefox
IIspeeding up firefox with tmpfs and automatic rsync
LinuxQQIO
8.DIFF
ssh user@host cat /path/to/remotefile | diff /path/to/localfile diff-stdin
sshwebsshfs---
9.
netstat -tulnp
NetstatLinux
-t: TCP
-u: UDP
-l:
-n: ip
-p: PIDroot
socketslsof
B Linux Shell
WowUbuntu / Isspy
=== ===
1.
mount | column -t
column
columnt
mount
$ mount
/dev/root on / type ext3 (rw)
/proc on /proc type proc (rw)
/dev/mapper/lvmraid-home on /home type ext3 (rw,noatime)
column -t
$ mount | column -t
/dev/root on / type ext3 (rw)
/proc on /proc type proc (rw)
/dev/mapper/lvmraid-home on /home type ext3 (rw,noatime)
B Linux Shell
WowUbuntu / Isspy
$ nicemount
DEVICE PATH TYPE FLAGS
/dev/root / ext3 (rw)
/proc /proc proc (rw)
/dev/mapper/lvmraid-home /home ext3 (rw,noatime)
2. Shell "bar" "foo"
!!:gs/foo/bar
!! :gs/foo/bar
!!
3.
watch -d -n 1 'df; ls -FlAt /path'
/path watch -d
-n 1 1
df; ls -FlAt /path df ls -FlAt /path
ls -FlAt
-F */=>@| *
/ = ( sockets) > @ |
B Linux Shell
WowUbuntu / Isspy
-l
-A . ..
-t
4. SSH
sshfs name@server:/path/to/folder /path/to/mount/point
SSH
FUSE sshfs
"hacker"
$ dig +short txt hacker.wp.dg.cx
"Hacker may refer to: Hacker (computer security), someone involved
in computer security/insecurity, Hacker (programmer subculture), a
programmer subculture originating in the US academia in the 1960s,
which is nowadays mainly notable for the free software/" "open
source movement, Hacker (hobbyist), an enthusiastic home computer
hobbyist http://a.vu/w:Hacker"
dig DNS +short
txt TXT
B Linux Shell
WowUbuntu / Isspy
$ wiki hacker
"Hacker may refer to: Hacker (computer security), ..."
dig host
host -t txt hacker.wp.dg.cx
6. Wget
wget --random-wait -r -p -e robots=off -U Mozilla www.example.com
- -limit-rate=20K 20K
-o logfile.txt
-l 0 5
--wait=1h 1
7.
ALT + . (or ESC + .)
shell emacs
B Linux Shell
WowUbuntu / Isspy
$ echo a b c
abc
$ echo <Press ALT + .>
$ echo c
$ echo 1 2 3
123
$ echo a b c
abc
$ echo <Press ALT + .>
$ echo c
$ echo <Press ALT + .> again
$ echo 3
12 n ALT + 1 ( ESC +
1) ALT + 2 ( ESC +2)
$ echo a b c
abc
$ echo <Press ALT + 1> <Press ALT + .>
$ echo a
a
$ echo <Press ALT + 2> <Press ALT + .>
$ echo b
b
"Emacs Editing Mode Keyboard Shortcuts "
8. history
<space> command
Bash shell shell
------ Twitter: @isspy
B Linux Shell
WowUbuntu / Isspy
bash history
(~/.bash_history) $HISTIGNORE shell
HISTIGNORE="&:[ ]*" history
$HISTIGNORE
"The Definitive Guide to Bash
Command Line History"
9.
du -h --max-depth=1
- -max-depth=1 du 1
1 2 2 -h
Mb G
ncdu
10. 10
ps aux | sort -nk +4 | tail
B Linux Shell
WowUbuntu / Isspy
-c DebuggingServer Python
localhost:1025 Python 1025 SMTP
25 sudo
root 1-1024
sudo python -m smtpd -n -c DebuggingServer localhost:25
=== ===
1.ASCII
man 7 ascii
asciiascii
Linux Manpage
ascii
manprintfC
printfbashprintfman 3 printfman 1 printf
1
man man
manpages
man 1 intro - Linux
man 2 syscalls -
man 2 select_tut - select()
man 3 string -
man 3 stdio - /
man 3 errno - errornoC
B Linux Shell
WowUbuntu / Isspy
B Linux Shell
WowUbuntu / Isspy
time read
3.WINDOWS
net rpc shutdown -I IP_ADDRESS -U username%password
WindowsnetRPC
winnet use file:///C|/ip/ipc%24 *IPC
Linuxnetsambasmbclientwindows
rpc
Windowsshutdown
winnetwin
4.SHELL
(cd /tmp && ls)
ls /tmp
shell
shell
Shell`ls /tmp`shell
B Linux Shell
WowUbuntu / Isspy
host_B
tput clear
tputman tput
7.
ping -a IP
4scsi16Redhat
pingaudible ping-aping
8.10
history | awk '{a[$2]++}END{for(i in a){print a[i] " " i}}' | sort -rn | head
historyawksort
head10
B Linux Shell
WowUbuntu / Isspy
9.GMAIL
curl -u you@gmail.com --silent "https://mail.google.com/mail/feed/atom" |
perl -ne \
'
print "Subject: $1 " if /<title>(.+?)<\/title>/ && $title++;
print "(from $1)\n" if /<email>(.+?)<\/email>/;
'
GmailAtom feedGmail
atom
perlatomsed/awk
10.TELNET
telnet towel.blinkenlights.nl
ASCIIipv6
B Linux Shell
WowUbuntu / Isspy
ShellShell
TIOBE
GUI
ShellShellCPerlPython
Shell
Shell
Shell
Shell
Shell
Advanced Bash-ScriptingBash Guide for Beginners
""unix
""