*nix
Jump to navigation
Jump to search
Mainly linux, some unix-like.
Guides
- tuXfiles - Linux help
- GNU/Linux Practice Note
- Linux Commands - A practical reference
- Linux Resources
- Settling into Unix
- Relational shell programming
- shortcutworld.com - keyboard shortcuts wiki
- The Art of Unix Programming Eric Steven Raymond
- Unix as IDE
File structure
- Linux Directory Structure (File System Structure) Explained with Examples
- Understanding the bin, sbin, usr/bin , usr/sbin split [2]
Tools and help
Dotfiles
Command line
- Shell - Bash, Zsh, etc.
- World's best introduction to sed [4]
- awk
- ack - ack is a perl tool like grep for programmers
Terminals
Basics
- Wikipedia:Pseudo terminal, Wikipedia:Virtual console (computer user-interface), Wikipedia:Terminal emulator, Wikipedia:Control character, Wikipedia:Escape sequence, Wikipedia:Escape character, Wikipedia:C0 and C1 control codes, Wikipedia:Terminfo
- ASCII Characters for MPE Users (control char info)
Urxvt
tabbed is good, plus tmux.
Screen
config goes in ~/.screenrc
escape ^Ww change escape key to w
Tmux
config goes in ~/.tmux.conf
- http://blog.hawkhost.com/2010/07/02/tmux-%E2%80%93-the-terminal-multiplexer-part-2/
- http://www.linuxized.com/2010/05/switching-from-gnu-screen-to-tmux/comment-page-1/#comment-2148
Misc
- ArchWiki: Improve Boot Performance#TTY terminal management
- StackOverflow: Can terminals detect <Shift-Enter> or <Control-Enter>?
- Home and End keys not working
- That 256 Color Thing, P.C. Shyamshankar
- Super User: TTY with 256 colors?
- The Text Pistols
- Wikipedia:Plan 9 from Bell Labs
System
- lsof - "lists open files"
- top
- htop
- atop
iostat, vmstat, free
Finding files
find /usr/share -name README find ~/Journalism -name '*.txt' find ~/Programming -path '*/src/*.c' find ~/Images/Screenshots -size +500k -iname '*.jpg' find ~/Journalism -name '*.txt' -exec cat {} ; find ~/Journalism -name '*.txt' -print0 | xargs -0 cat (faster than above)
- sgrep - search a file for a structured pattern
Moving files
scp -P 2264 foobar.txt your_username@remotehost.edu:/some/remote/directory scp -rP 2264 folder your_username@remotehost.edu:/some/remote/directory
Package management
Apt
dpkg --get-selections > installed-software create list of installed software dpkg --set-selections < installed-software dselect reinstall from list
Pacman
- cacheclean - Cleans up pacman packages. Users selects how many old versions to keep.
cacheclean {-p} {-v} <# of copies to keep> # of copies to keep - (required) how many generations of each package. -p - (optional) preview what would be deleted. -v - (optional) show deleted packages.
Compression
# Extract Files extract() { if [ -f $1 ] ; then case $1 in *.tar.bz2) tar xvjf $1 ;; *.tar.gz) tar xvzf $1 ;; *.tar.xz) tar xvJf $1 ;; *.bz2) bunzip2 $1 ;; *.rar) unrar x $1 ;; *.gz) gunzip $1 ;; *.tar) tar xvf $1 ;; *.tbz2) tar xvjf $1 ;; *.tgz) tar xvzf $1 ;; *.zip) unzip $1 ;; *.Z) uncompress $1 ;; *.7z) 7z x $1 ;; *.xz) unxz $1 ;; *.exe) cabextract $1 ;; *) echo "\`$1': unrecognized file compression" ;; esac else echo "\`$1' is not a valid file" fi }
Disk usage
du -sh size of a folder du -S size of files in a folder du -aB1m|awk '$1 >= 100' du -sk ./* | sort -nr | awk 'BEGIN{ pref[1]="K"; pref[2]="M"; pref[3]="G";} { total = total + $1; x = $1; y = 1; while( x > 1024 ) { x = (x + 1023)/1024; y++; } printf("%g%s\t%s\n",int(x*10)/10,pref[y],$2); } END { y = 1; while( total > 1024 ) { total = (total + 1023)/1024; y++; } printf("Total: %g%s\n",int(total*10)/10,pref[y]); }' foooked?
todo; source aliases.zsh
Time
Convert unixtime into date;
date -d @1337000000
- Linux, Clocks, and Time
- tzconfig / dpkg-reconfigure tzdata
ntpdate pool.ntp.org && hwclock --systohc && hwclock --adjust Synchronize both your system clock and hardware clock and calculate/adjust time drift. Do not run this command if you already have ntpd running! [6]
Users
cat /etc/passwd | cut -d: -f 1,3,6 | grep "[5-9][0-9][0-9]" List users on a system [7]
GUI
- http://www.tomshardware.com/reviews/image-software-linux-gimp,2801-3.html
- http://linuxcrunch.com/content/gwenview-best-image-viewer
X
Window Managers
Openbox
Distros
- Android - Distros
Arch
Debian
Other software
- http://kmandla.wordpress.com/software/
- http://blog.chavezgu.com/2012/03/07/the-command-line-challenge/
CUPS
Printing system.
Regex
Security
- http://www.truecrypt.org/ - hard drive space
- http://www.keepassx.org/ - passwords
- http://safeharbor.export.gov/list.aspx - UK DPA safe harbours
Networking
- sudo /etc/init.d/<service> restart - ubuntu, restart a service
- sudo /etc/rc.d/<service> stop | start | restart - arch, service things
- sudo sh -c "echo 'something' >> /etc/privilegedfile"
- chown -R user:group . - change all and subitems [8]
- Linux DNS Lookup Command - host & dig
- route -n - display the host's networks and gateway
- /etc/hosts
- /etc/network/interfaces - ubuntu network interface settings
- /etc/resolv.conf - dns settings
- /etc/host.conf - dns resolve order
- /etc/dhcp3/dhclient.conf - overrides ubuntu server dns settings. change prepend option.
- /etc/dnsmasq.conf - dnsmasq settings
- dnsmasq configuration
- Local DNS cache in Linux using dnsmasq
- View The Daily Show, etc. in the UK, etc. Mofity HTTP headers; X-Forwarded-For "12.13.14.15" [10]
Cisco
Media
To check;