Various
From Systerserver
hard and soft links
- HL to physical data (inode), can be many and each have same counter, ie HL = COPY
- HL can have multiple names for same file
- a SL is a shortcut, pointer
- a directory can be SL'd but not HL'd
- SL across filesystems (even across networks) but HL only within a filesystem
- hard links allow files to be easily accessed in a different directory from the original file. Typing the name of the hard link will cause the program or script to be executed in the same way as using its original name.
- SL are used to shorten path, or give a generic name to an app eg /usr/bin/gcc -> gcc-4.4
- SL to save space, share a single file
file type (special)
- character file - accepts input one bit at a time
- block file - accepts input in blocks (groups of bytes) eg block files often point to storage devices
- Bash
-b filename - Block special file
-c filename - Special character file
CRON
.------------------ minute (0 - 59)
| .--------------- hour (0 - 23)
| | .------------ day of month (1 - 31)
| | | .--------- month (1 - 12) OR jan,feb,mar...
| | | | .------ day of week (0 - 7) (Sunday=0 or 7) OR sun,mon,tue...
| | | | |
* * * * * command to be executed
0 0 1 1 *: Run once a year
0 0 1 * *: Run once a month
0 0 * * 0: Run once a week
0 0 * * *: Run once a day
0 * * * *: Run once an hour
SCREEN
- screen -S (to start a new screen, and giving it a title/name)
- CTRL+A+D to detach
- screen -r to reattach
- screen -x to attach to a session that is attached, ie let many users into one screen simultaneously
- http://www.linux.com/learn/tutorials/285795-taking-command-of-the-terminal-with-gnu-screen-
Midnight Commander FAQ
MC in the Mac OS X terminal
- if you want FN10 (function key 10) to quit, press ESC and 0
- likewise ESC 3 to View (FN3), etc....
reset mysql root password
- /etc/init.d/mysql stop
- /usr/bin/mysqld_safe --skip-grant-tables &
- mysql --user=root mysql
- update user set Password=PASSWORD('BlaBla') WHERE User='root';
- flush privileges;
- exit
- fg and Ctl+C to foreground the mysql service which was running in safe-mode and kill it
- /etc/init.d/mysql start
- mysql -u root -p BlaBla
- exit
- ps above password is not used anywhere :)
- pps you need to use sudo or be root to do above
partition, format and label an external disk (hdd, usb, ...)
- sudo su
- partitioning: fdisk
- and then format
- mkfs.ext3 /dev/sdb1 or mkfs -t ext3 -L mijnlabel /dev/sda2
- mkfs -t vfat -F 32 /dev/hdb1
- mkfs.vfat -F 32 -n volume_name /dev/sda1
- tune2fs -L mijnlabel /dev/sda2
- LABEL=mijnlabel ipv /dev/sda2
- e2label /dev/sdb1 flash (only works on ext2 and ext3 file systems, ie not on a vfat formatted partition)
- use mlabel (part of mtools) to change volume label vfat formatted usb flash drive
- mkfs -i om de inode grote te bepalen; wordt veel gebruik; zal je het meest tegen komen
- mkfs -m om vrije ruimte te bepalen
- e2fsck
- debugfs
launch sequence
- 1. bootloader activated (eg GRUB which is situated in the /boot)
- 2. kernel loaded
- 3. init activated (it's a process, the first) and inittab is read
- 4. distro's boot scripts are executed
- 5. shell is started
- what is the bootsector?
- what is the MBR?
checks before rebooting
- to see which files are open / in use: smbstatus
- which services are running and need to be running again after reboot:
- netstat -paten
- almost the same, maybe even better:
- lsof -Pan -i tcp -i udp
- who's logged on: lsof |grep home
- what's mounted; after reboot see if the same are mounted again.
- if ever you do a fscheck, run it in screen.
locales settings
- dpkg-reconfigure locales
- en_US.UTF-8-> Unicode for all regions, mostly in 1-3 Octets (new de facto standard)
- en_US ISO-8859-1 -> western Europe (de facto old standard)
- en_US.ISO-8859-15 -> western Europe with euro
generate random password
- pwgen -Bs 6 1
- https://passwd.me/
- http://www.passwordmaker.org/
first things to install
I've just installed Debian and still need....
- ssh, sudo, htop, nmap
- vim, screen, mc, mtr
- logcheck, cron-apt, denyhosts
- aptitude, failtoban, iptraf?
- harden-servers and harden-clients
first things to do
- adduser (not useradd)
- edit sudoers file
- edit /etc/ssh/sshd_config (see security section)
- update-alternatives --config editor
finding information about your monitor
- install xresprobe, then run for eg:
- ddcprobe | grep monitorrange
.htaccess
- is the default name of a directory-level configuration file that allows for decentralized management of web server configuration.
.robots.txt
- developed in 1994
- the Robot Exclusion Standard or Protocol, is a convention to prevent web spiders and robots from accessing all or part of a website which is otherwise publicly viewable.
BIOS to disk cylinder limit / boundry
- 512 cylinder - overcome in mid-94
- 1024 cylinder
- 4096 cylinder (1.97 GB) barrier - was overcome after 1996
- 6322 cylinder barrier (very uncommon)
- Int13h (7.88 GB) barrier - very common; a BIOS upgrade may be available
- 65536 cylinder (31.5 GB) barrier - fixed by June 1999
- ATA28 (128 GB) barrier - found in most systems before 2002
selections
- selections is the cut/copy/paste/drag-n-drop world
- keeps data in cache or the clipboard
- can be manipulated with mouse (scroll-wheel click etc) or keyboard
- Primary: X-specific, data copied into cache and pasted with middle mouse button
- Secondary: the Clipboard app, right-click to copy/cut paste
- cut buffer, clipboard
- http://en.wikipedia.org/wiki/X_Window_selection
shortcuts
- SuperL or Mod4 key -> to launch gnome-terminal
on organising free people
Managing Software
RPM
- rpm requires full file name when installing but not when uninstalling
- rpm -i bla.rpm
- rmp -e bla
- rpm -Uvh *.rpm (-U for update which also install files not yet installed; -F for freshen which only updates)
- v = verbose and h = hash
- rpm -q bla
- rpm -qi bla (q = query, i = info)
- rpm -qf /usr/bin/vim (f = find what packages owns the file) (Which package put this file here?)
- rpm -ql bla (l = list of files in an installed package) (List the files that a package contains)
- rpm -qlc (only list configuration files)
- rpm -qld (only list documentation file)
- rpm -qp *.rpm (to list a downloaded package, ie not installed yet)
- rpm -qa | sort | more (all installed packages)
- rpm -qal | wc -l (a count of all _files_ in all packages on the system)
- rpm -qpR {.rpm-file} - find dependencies of ile
- rpm -qR {package} - find out dependencies of package
- rpm -vK vim-enhanced-7.2.411-1.fc12.x86_64.rpm (--checksig = -K)
- rpm -V vim-common (verify if corrupt or not)
- yum reinstall vim-common
- Wildcards work with filenames, but not with package names.
- Any package filename argument can be replaced with a full URL of where to get the package from.
- --test to see what a command would do without actually doing it.
YUM
- yum requires only the package name both with installing and uninstalling
- yum install bla (install from package repository)
- yum localinstall bla (install from a downloaded package file)
- yum remove bla
- yum update bla (update installed software and system)
- yum list bla
- yum info bla
- yum search bla
- yum check-update (update package list, repos)
semi precious minerals
- on the CLI typing $! stops the last command you typed in (or not?)
- typing CTRL+C (^c) interrupts (sigint), CTRL+Z suspends (sigsusp)
- CTRL+D is not a signal, it's EOF (End-Of-File). It closes the stdin pipe. If read(STDIN) returns 0, it means stdin closed, which means CTRL+D was hit (assuming there is a keyboard at the other end of the pipe).
- USR1 ?
- << ?
newline
- a newline is represented by one or two control characters:
- LF (Line feed, '\n'
- CR (Carriage return, '\r'
STDIN, STDOUT, STDERR
- stdin = 0, stdin = 1, stderr = 2
- eg. << Redirects STDIN output to a file until a predefined marker is reached.
- cat > foo.txt << MYSTOP
- Hello world!
- Hello shoe!
- MYSTOP
network speeds
- Mbps is a million “bits” per second
- modem 56.6 kbps
- office 100 Mbps
- wifi
- 3G (beginning 2010, Vodaphone) 7.2 Mbps
Find out if a process is chrooted
- run ls -ld command on /proc/MAIN-PID/root directory
- to find process id of httpd: pidof httpd
If you're interested in a job in international development cooperation
- www.oneworld.nl
- www.vacatureblad.org
- www.deduurzamevacaturebank.nl
- www.reliefweb.int/vacancies
Worried about the energy consumption of your machine?
- get and run PowerTop
- http://www.lesswatts.org/projects/powertop/
CLI clipboard
- primary and secondary X selection
- secondary hardly never used
- two apps, xsel and xclip
- xsel more advanced and nicer syntax
What's in a name
- the infamous thinkpad tracknub, never heard of the term. but i have heard of clit, clitmouse, nipple, nipple mouse, g-spot (it's red and next to the g on the keyboard)
- http://xkcd.com/243/
- "mouse noses"
UTC or localised time zone?
- always use UTC on a server
- unless you have a dual boot with some funny OS which expects the hardware clock to be in local time
info on the /etc/network/interfaces file
- if you lack network support while booting "allow-hotplug" won't freeze until dhclient times-out (with auto it does)
define:CLOUD
- "The cloud" in general refers to the concept of being able to provision computer resources (CPU, storage space, memory) in a scalable way, without having to worry about buying individual servers
- not to be confused with "Cloud Services" (or "Software as as Service" -- SaaS) eg file and calendar sharing