Tcsh aliases

Материал из wiki.lissyara.su
Перейти к: навигация, поиск
### tcsh aliases
# you can paste entire file directly to ~/.tcshrc
#
# Note:
# (~)! - denotes superuser shell
# (~). - denotes normal user shell

# play music or video silently (depends on multimedia/mplayer)
#
# (~). mp \[K-F]_One_Piece_245_\[7EB71ABA].mp4 &
# [2] 64124

alias	mp	mplayer \>\&/dev/null \</dev/null -noconsolecontrols -slave -really-quiet

# show word definiton from wiktionary dict mirror (depends on ftp/curl)
#
# (~). di blah
# en-brief "en.wiktionary.org (brief)"
# blah
#   English
#     Noun
#       1. {{uncountable}} nonsense, drivel
#       2. {{rfv-sense}} {{in plural}} a general feeling of discomfort,
#          boredom, etc
#
#     Adjective
#       1. dull and uninteresting
#
#     Interjection
#       1. representing the sound of vomiting
#
#
# Ref: http://en.wiktionary.org/wiki/blah
# .

alias	di	'curl -s "dict://dict.hewgill.com/d:\!{*}:en-brief" | sed -E "/^220.*|^250.*|^150.*|^221.*/d; s/^151[[:space:]]*"\""\!*"\""[[:space:]]*(.*)/`echotc md``echotc AF 4`\1`echotc me`/"'
alias	diru	'curl -s "dict://dictd.xdsl.by/d:\!{*}:*" | sed -E "/^220.*|^250.*|^150.*|^221.*/d; s/^151[[:space:]]*"\""\!*"\""[[:space:]]*(.*)/`echotc md``echotc AF 4`\1`echotc me`/"'

# strip #-like comments and blank lines
#
# (~). noc /sys/amd64/conf/DEFAULTS
# machine         amd64
# device          isa
# device          mem
# device          io
# device          uart_ns8250
# options         GEOM_BSD
# options         GEOM_MBR

alias	noc	'sed "s/[[:space:]]*#.*//; /^[[:space:]]*"\$"/d"'

# make using rtprio/idprio a lil' bit easier
#
# set:   (~)! rtprio 10 mplayer xmp
# unset: (~)! rtprio -t mplayer xmp
# run:   (~)! \rtprio 10 mplayer

foreach alias ( idprio rtprio )
    alias $alias "pgrep \!:2* | xargs -n1 -I% $alias \!^ -%"
end

# copy contents from one dir to another, preserving ACL, hardlinks, flags, etc
#
# (~). mkdir blah
# (~). migrate /sbin blah
# (~). echo init md5 sha1 | xargs -n1 -I% ls -lio /sbin/% blah/% | sort
# 22888 -r-xr-xr-x  1 root  wheel  schg 3243658 Dec  2 01:31 /sbin/init
# 22904 -r-xr-xr-x  4 root  wheel  - 28546 Dec  2 01:31 /sbin/md5
# 22904 -r-xr-xr-x  4 root  wheel  - 28546 Dec  2 01:31 /sbin/sha1
# 69229 -r-xr-xr-x  1 root  wheel  schg 3243658 Dec  2 01:31 blah/init
# 69244 -r-xr-xr-x  4 root  wheel  - 28546 Dec  2 01:31 blah/md5
# 69244 -r-xr-xr-x  4 root  wheel  - 28546 Dec  2 01:31 blah/sha1

alias	migrate	'tar cf - \!:3* -C\!^ . | tar xUpf - -C\!:2'

# generate random string of 8 ascii chars
#
# (~). rand
# B'9UzE9A
# {-ne]g}(
# {&yh3Vp:
# Ka9df"'B

alias	rand	'jot -rc 32 33 126 | rs -g 0 8'

# push memory back from disk

alias	reswap	'swapoff -aq && swapon -aq'

# show order of installed ports with most recent ones first
#
# (~). pp | head
# Dec  2 10:45:14 2008 tcl-threads-8.5.5
# Dec  2 10:43:16 2008 tcl-8.5.5
# Dec  2 00:11:57 2008 emacs-23.0.60.20081201_1
# Dec  1 19:08:44 2008 widelands-b13.r
# Dec  1 17:55:49 2008 sdl_gfx-2.0.17
# Dec  1 17:55:36 2008 sdl_ttf-2.0.9
# Dec  1 17:55:22 2008 sdl_net-1.2.7
# Dec  1 17:55:12 2008 sdl_mixer-1.2.8_1
# Dec  1 17:54:47 2008 libvorbis-1.2.0_2,3
# Dec  1 17:54:17 2008 libogg-1.1.3,4

alias	pp	'stat -f "%m%t%Sm %N" /var/db/pkg/*/+DESC | sed "s|/var/db/pkg/||; s|/+DESC"\$"||" | sort -rn | cut -f2- | $PAGER'

# list port dependencies of an ELF file
#
# (~). dep uim-fep
# converters/libiconv
# devel/gettext
# textproc/uim

alias	dep	'ldd -af%p\\n `which \!*` | fgrep -v : | xargs -n1 pkg_info -qW | xargs pkg_info -qo | sort -u'

# grep process
#
# (~). pl xmp w3m
#   UID   PID  PPID CPU PRI NI   VSZ   RSS MWCHAN STAT  TT       TIME COMMAND
#  1001  1891  1864   0  44  0  6896   260 select S+     0    0:07.41 [xmp]
#  1001 59885 59727   0  44  0 18672  7492 -      T      4    0:00.30 w3m forum.lissyara.su

alias	pl	'ps lwwp`pgrep \!*`'

# process tree (depends on sysutils/pstree)
#
# (~). pt xmp w3m
# ─┬◆ 00001 root /sbin/init -s
#  └─┬◆ 01846 root screen
#    └─┬◆ 01847 nail sh -c (cd /d/muz/tma; random -f tma.lst | head -200 | xargs -o xmp -v)
#      └─┬─ 01852 nail sh -c (cd /d/muz/tma; random -f tma.lst | head -200 | xargs -o xmp -v)
#        └─┬─ 01864 nail xargs -o xmp -v
#          └─── 01891 nail [xmp]
# ─┬◆ 00001 root /sbin/init -s
#  └─┬◆ 01846 root screen
#    └─┬◆ 59727 nail /bin/tcsh
#      └──◆ 59885 nail w3m forum.lissyara.su

alias	pt	'echo \!* | xargs -n1 pstree -g2 -s'

# show man page inplace
#
# (~). mm dist/mplayer/DOCS/man/en/mplayer.1

alias	mm	'tbl \!* | groff -S -Wall -mtty-char -man -Tascii | col | $PAGER'

# show mlnet downloading status (depends on net-p2p/mldonkey)
#
# (~). vd
# Down: 207.5 KB/s ( 58 + 212469 ) | Up: 274.5 KB/s ( 78 + 281019 ) | Shared: 6/36.06G | Downloaded: 3.41G | Uploaded: 3.88G
#   Num   Rele Comm User   Group                          File                            %     Done     Size lSeen  Old  Active  Rate  Prio
# [B   5] -       0 admin mldonkey [A-E_Ureshii]_Mnemosyne_[AC3-H264-DVD]              98.3    4.0gb    4.1gb  0:01  2:0 11/24    26.7    -1
# [B   2] -       0 admin mldonkey Freedom_[720p,BluRay,x264,DTS]_-_THORA              95.9    5.3gb    5.5gb  0:14  2:0  6/53    76.6     0
# [B   1] -       0 admin mldonkey [TSR]_Death_Note_01-37.DVD[H264,Vorbis](Complete)   74.4    6.2gb    8.4gb  0:52  3:0  4/11    66.1    20
# [B   4] -       0 admin mldonkey Patlabor_the_Movie_2_(1993)_[1080p,BluRay,x...HORA   0.0    2.7mb    7.9gb  0:24  2:0  0/6    Queued  -20
# [B   3] -       0 admin mldonkey Patlabor_the_Movie_(1987)_[1080p,BluRay,x26...HORA   0.0    1.5mb    7.9gb  1:00  2:0  0/5    Queued  -10
# Downloaded 0 files
#
# (~). vd 5
# [BitTorrent     5]
# [A-E_Ureshii]_Mnemosyne_[AC3-H264-DVD]
# directory
# urn:bt:AZCQPJLCMM7XEUXZ5R2PQ57S5OKXAIJK
# Total   4396057043
# Partial 4396057043
# priority -1
# Owner/Group: admin/mldonkey
# Chunks: []
# Trackers:
# http://tracker.scarywater.net:443/announce
# Torrent diskname: torrents/downloads/[A-E_Ureshii]_Mnemosyne_[AC3-H264-DVD].torrent
# Creation date: 00:17  Wed 29 Oct
# Subfiles: 6
# File 1: [A-E_Ureshii]_Mnemosyne_-_02v2_[AC3-H264-DVD][DC99DB35].mkv (730615501 bytes)
# File 2: [A-E_Ureshii]_Mnemosyne_-_03_[AC3-H264-DVD][6E543F20].mkv (730482183 bytes)
# File 3: [A-E_Ureshii]_Mnemosyne_-_04_[AC3-H264-DVD][1B7AAB48].mkv (733556332 bytes)
# File 4: [A-E_Ureshii]_Mnemosyne_-_05_[AC3-H264-DVD][2F3911E5].mkv (733492207 bytes)
# File 5: [A-E_Ureshii]_Mnemosyne_-_06_[AC3-H264-DVD][71AD6F40].mkv (733872826 bytes)
# File 6: [Ureshii]_Mnemosyne_-_01_[AC3-H264-DVD][8F67BD2B].mkv (734037994 bytes)

# Num UID Soft IP address Port CC tUL tDL sUL sDL I C A I A N G I B T L.Opt N D C F U A 0
# 7469 FVKVIMJYGEYC2XZRSQ5DUXDTEOPQKKFF uTorrent 1.8.1 81.173.254.125 62049 DE 0 0 0 0 T T 0 F F F F T T 228224527 never 0 T F T T F 27
# 6203 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA unknown  195.229.241.171 63124 AE 0 0 0 0 F T 0 F F F F F F 228221573 never 0 F F F F F 0
# 7416 FVKVIMJVGAYC3NEBCXWEL2JIQE6TLVVG uTorrent 1.5.0 96.241.119.5 2180 US 0 1024.0k 0 1024.0k F F 0 T T F T T T 228224345 never 0 F F F T F 1049
# 7480 FVKVIMJYGEYC2XZRZZAM77OOHN25H4KA uTorrent 1.8.1 67.161.110.221 1413 US 0 0 0 0 F T 0 T T F F T T 228224596 never 0 T F T T F 1025
# 7407 MV4GEYYBAFGE6USEEN3YNQPHQ7RYL2SO BitLord 1.1 125.238.246.178 50815 NZ 0 0 0 0 T T 0 F F F F T T 228224303 never 0 F F F F F 31
# 4039 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA unknown  195.229.241.173 63124 AE 0 0 0 0 F T 0 F F F F F F 228216397 never 0 F F F F F 0
# 7447 MV4GEYYBAFGE6USET4BODVIJC6YSP6Q4 BitLord 1.1 68.203.15.103 54792 US 0 0 0 0 F F 0 T T F T T T 228224440 never 0 F F F F F 1049
# 7245 FVKVIMJYGEYC2XZR4VIU2SORUGTRPP6B uTorrent 1.8.1 84.250.220.58 4300 FI 0 976.0k 0 976.0k F F 0 T T F T T T 228223959 never 0 T F T T F 1025
# 7235 FVAVUNBQGA2C232RMFXTGQ2NOJEDS2BZ Azureus 4.0.0.4 98.117.212.163 54027 US 0 688.0k 0 688.0k F T 0 F T T T T T 228223921 never 0 F F F T T 557
# 7338 FVKVIMJYGEYC2XZRCCXHEZCBRKE5UHWR uTorrent 1.8.1 125.255.15.43 4313 AU 0 240.0k 0 240.0k T T 0 F T T T T T 228224233 never 0 T F T T F 656
# 6952 FVBEGMBQGYYC2DPHEZIPDCXP6U26PAZ3 BitComet 0.60 68.80.211.25 15282 US 0 2.4M 0 2.4M F F 0 T T F T T T 228223258 never 0 F F F F F 1049
# 5960 FVKVIMJYGEYC2XZRR2FQPUPOPVSF3P2M uTorrent 1.8.1 79.165.40.32 2034 RU 0 17.5M 0 17.5M F F 0 T T F T T T 228221172 never 0 T F T T F 1026
# 7121 MV4GEYYBAFGE6USEWVJDV2XTHZKYA7HJ BitLord 1.1 202.22.143.31 3697 NC 0 32.0k 0 32.0k T F 0 F T T T T T 228223644 never 0 F F F F F 940
# 7453 FVMEYMBQGEZC23M5TSCU7X57QXSVRY7L XunLei 0.0.1.2 124.13.109.180 18811 MY 0 0 0 0 T T 0 T T F F T T 228224466 never 0 T F F F F 586
# 7467 FVAVUNBQGA2C2WKXGJ4VSTDRGBGFCSKO Azureus 4.0.0.4 68.147.43.69 62857 CA 0 0 0 0 F F 0 T T F T T T 228224518 never 0 F F F T T 1031
# 7116 FVKVIMJYGAYC2JJOLBW3O7TRWZJGLSU2 uTorrent 1.8.0 89.164.228.130 51323 HR 0 14.4M 0 14.4M F F 0 T T F T T T 228223626 never 0 T F T T F 1025
# 7452 FVBEGMBQG4YC33WTAX364QDXUXK2Z4X5 BitComet 0.70 58.136.95.2 3184 TH 0 0 0 0 T T 0 F F F F T T 228224452 never 0 F F F F F 180
# 7030 FVMEYMBQGEZC2YA6UZTID5HNTK6HYRJM XunLei 0.0.1.2 58.182.122.203 1532 SG 0 192.0k 0 192.0k T T 0 F T T T T T 228223523 never 0 T F F F F 317
# 699 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA unknown  195.229.241.174 63124 AE 0 0 0 0 F T 0 F F F F F F 228208095 never 0 F F F F F 0
# 7015 FVGFIMCDGAYC2QRNFFLXISLPN5YWSVRT libTorrent 0.C.0.0 58.9.5.59 4367 TH 0 4.3M 0 4.3M F F 0 T T F T T T 228223459 never 0 T F F T F 1049
# 6179 FVKFEMJUGAYC24BXPAZXSMZWNRVHGMBR Transmission 14.0 70.130.177.191 51413 US 0 1.1M 0 1.1M F F 0 T T F T F T 228221573 never 0 F F F T F 1023
# 7410 FVFVIMZRGIYC2USVIFIUYR22JBUTAULG KTorrent 3.1 82.128.220.190 33872 FI 0 12.8M 0 12.8M F T 0 F T T T T T 228224313 never 0 T F T T F 1049
# 7465 FVKVIMJYGEYC2XZRRBR2TRWALKVQEDQ2 uTorrent 1.8.1 65.35.144.207 3623 US 0 0 0 0 F T 0 T T F F T T 228224515 never 0 T F T T F 1025
# 7446 FVAVUNBQGA2C2RLVGVHVIZDIIVFHCVTB Azureus 4.0.0.4 98.148.116.253 2584 US 0 48.0k 0 48.0k F T 0 F T T T T T 228224437 never 0 F F F T T 1049
# 7442 MV4GEYYAHCUG2IOV7XEKGGNNIYKTOY5P BitComet 0.56 85.186.2.135 3612 RO 0 304.0k 0 304.0k T F 0 T T F T T T 228224422 never 0 F F F F F 628
# 6910 FVWHIMCDGIYC37XINOPXDAXNKGBTXFZ5 libTorrent 0.C.2.0 193.11.22.34 51280 SE 0 6.2M 0 6.2M F F 0 T T F T T T 228223100 never 0 T F F T F 1049

alias	vd	'printf "auth admin pass\nvd \!*\n" | nc server 4000 | sed "1,/\!:0/d; /command-line/,"\$"d"'