From Bitpost wiki
Jump to: navigation, search

My scripts:

sc                              show most-common quick-scripts - let's use that and not maintain a list here too!


cp -axv drive drive_backup      clone an unmounted linux system
ps ax|grep blah                 show running processes with "blah" in them
lsof -c cp                      show open files for any process starting with "cp"
lspci                           list all the hardware using the PCI bus (video cards, etc)
watch #command#                 repeat the command every 2 secs (default), showing output
tail -f #logfile#               display the tail end of the logfile, in realtime
shutdown -rF now                reboot, forcing an fsck on startup (or, put a [forcefsck] file in drive root)
fuser -m /dev/hdb1              find open files on a drive, then processes that have the file(s) open
  /dev/hdb1: 538
ps auxw|grep 538
  donncha 538 0.4 2.7 219212 56792 ? SLl Feb11 11:25 rhythmbox
wc -l file                      count lines - can pipe to it too
find / -name "libjpeg*"         brute-force find (in this case, all libraries starting with jpeg...)
iostat -dx 5                    report on drive % utilization etc ("emerge systat" to get it)
iotop                           top for io, of course
hdparm -t /dev/sda              tests actual speed of hard drive


xrandr --output DVI-I-2 --off && xrandr --output DVI-I-2 --auto --right-of DVI-I-1     fixes lost monitor, also try arandr
sudo software-center [XXX.deb]                                                         to go to software center; specify a deb file to install (steam etc).
sudo unity-control-center                                                              all settings; also a pathway to upgrading and selecting nvidia driver
sudo lsb_release -a                                                                    display the ubuntu version

Gentoo-specific (see blog for USE flag notes):

elogviewer                      X app to list installed packages including installation notes
genlop -lu                      show the history of merged and unmerged packages
eix #search#                    search for all packages (available AND installed)
eix --world -c                  condensed list of all packages in your [world]
emerge -Davu blah               emerge package blah (if needed), confirming first
dispatch-conf                   handles updating of config files after emerge, see /etc/dispatch-conf.conf
equery uses #package#           show USE flags of package
equery depends #pkg#            show packages that depend on package
equery belongs #file#           show the package to which the file belongs
equery hasuse #flag#            shows packages that have the USE flag
equery depgraph --depth=# #pkg# shows the entire dependency tree for pkg
eix-sync                        grabs latest package list, updates portage and eix (usually called via cron)
emerge --emptytree --update world  CAREFUL, this reinstalls EVERYTHING :>


alsamixer                       set 7.1-channel HD audio volume levels
alsa-config                     test, set optimal audio levels
mythfilldatabase                fill TV listings database

For development:

git rebase --hard HEAD          throw away your local changes that have not yet been committed
git rebase --hard master        force the current branch to match master (losing ALL commits!)
cvs history -c [file]           get list of revisions for [file]
cvs diff -r 1.2 [file]          compare past revision to current
cvs diff -r 1.3 -r 1.2 [file]   compare two revisions

Run sc to get the latest list:

          useful commands and scripts

i3[scriptname]    run an i3-specific script
equery files pkg  show package files, use |less
elogv[iewer]      browse recent emerges and comments
edit_fluxbox_menu edit and apply fb menu changes
edit_firewall     edit, restart iptables w/screen
mdb-[]            access db tools
gtdm;gw;gd;gwa    go to tdm|wimpy|dune|wally via ssh
greplogs [term]   search logs for term [-C 3]
grepcode [term]   search code in curr dir for term
ds [dir]          get directory sizes
pk [proc_regex]   kill matches - type ALL for -9
lsof -c [proc]    show open files for process
which|whereis app show app location|paths
alsamixer         adjust sound levels
eq                finally an eq in linux, yay!
watch [command]   repeatedly run command
rs                restore screen (w/detach)
st;gt             search/get torrents
post_torrent      run from m@wimpy:rrip/flac (or mp3)
srd [#]           show most recent downloads
move_and_resymlink symlink destdir
resymlink symlink destdir (if file is already there)     torrent cleanup; run for usage
extract_tordir  extract dir from .torrent
ls_broken_symlinks uses curr dir
ls_nonsymlinks     uses curr dir
rm_broken_symlinks uses curr dir, WILL rm THEM
td;etd            show/edit active todo w/cvs
top               top resource-consuming procs
apachetop -f log  site-specific apache requests
ex;em             emacs with/without X
uc;cm             cvs update/commit (no message)
sp;ep             search/edit private data
edit_spam_[rules|settings]  what it says
edit_sieve_rules  edit mailfilter rules
tree -fid -L 1    great tree display of dir & files
edit_torrent_[]   shows (common) or rss (rare)
search_xbmc_keys  search key file for term
edit_world        edit portage master pkg list
xscreensaver-demo then select Disable to turn off
recordmydesktop   does what it says
bandwidth         monitor current bw usage
edit_rsync_jobs   edit bp<->tdm nightly rsync

trac-tda $1 $2    trac admin tool, RUN AS ROOT
erase_trac_ticket_block 17 20 blah  (run as root)
update_ampache_tda update music catalog, RUN AS ROOT
edit_gentoo_grub_cfg set up gentoo kernels on 3-boot

get_ampache_official changes 
get_ampache_official changes 
cdh;huc;hcm;hpush scripts to manage hangthedj repos
                  also see scripts/git_* helpers
ec2-ubuntu-ssh    ssh to amazon ec2 server
mp3search         search (and optionally copy mp3s