For security reasons, don't login directly as root. Instead login as an ordinary user and then use `su -' to get superuser privileges simulating a root full login (as if the root has logged in directly). Under FreeBSD and OpenBSD only users who are a member of group 0 (normally `wheel') can su to root. If group 0 is missing or empty, any user can su to root. Under Linux see suauth(5) or `info su'. % GNU screen is a terminal multiplexer that allows to run many console-based applications within a single terminal with session support. `screen' starts a new session, `screen -r' reattaches a detached session. Keybindings (C stands for Ctrl): C-a c create window C-a n/p switch to next/previuos window C-a N switch to the Nth window (N>=0) C-a C-a switch to window used before C-a " full screen windows list (keys: arrow/jk, enter) C-a w non-interactive windows list C-a A change window name C-a K force window closing C-a d detach from this session C-a [ enter copy mode (space to mark start/end of selection) C-a ] paste selection gathered in copy mode C-a _ start monitoring current window for 30 seconds of silence C-a M stop monitoring current window for activity C-a ? help (also see screen(1)) % If a PDF document allows copying of text, use `pdftotext doc.pdf' to convert `doc.pdf' to a plain text file `doc.txt'. If you only want to convert pages between X and Y and save the result as chapter.txt use `pdftotext -f X -l Y doc.pdf chapter.txt'. pdftotext(1) comes with xpdf(1). % If after (re)installing Windows(R), you can't boot into FreeBSD anymore, first use the DOS `fdisk' utility to set the FreeBSD slice as active. Then you can boot FreeBSD, log in as root and reinstall the default boot manager with `boot0cfg -B '. If you prefer you can make the Windows slice active again with `fdisk -a'. % If the Linux kernel has been configured with the options IKCONFIG and IKCONFIG_PROC (see "General setup menu" when using "make menuconfig"), the complete Linux kernel ".config" configuration file contents will be saved in the kernel image file. You can then use `zcat /proc/config.gz' to extract this information from a running kernel. % If while reading a mail message with mail(1) it scrolled too quickly, use `more n' where n is the message number (1 for the first message). The default paginator is more(1) but that can be changed by setting the PAGER environment variable. The command can be abbreviated, i.e. `mo 1'. % If you are unsure of what man page you are looking for, enter apropos subject-word where "subject-word" is your topic of interest; a list of possibly related man pages will be displayed. Also man -k subject-word is equivalent to apropos(1). % If you need to edit a file you are currently viewing with less(1), hit `v' to invoke an external editor, as defined by the VISUAL or EDITOR environment variables. By default vi(1) gets called. When you quit from the editor, you will return to view the updated file with less(1). % In Linux use the mii-tool(8) command to see if your network card has "link" and see the negotiated link speed. % In vim(1), to quickly display the man page related to the keyword under the cursor use the `K' command. To only look in a certain section, prefix the command with the section number. For example `3K' will give help on printf(3), not printf(1). The full documentation for the `K' command can be seen with `:help K'. % Linux procps package (/proc file system utilities) includes a command you can use to execute a shell command repeatedly. E.g. to watch the state of a point to point network interface type `watch ifconfig ppp0`. Add option -n sec to update output every sec seconds (2 by default). Ctrl-c to exit. % Manage your personal todo list (defaulting to $HOME/.todo) using todo. todo(1) is one of open-motif demonstration programs, uses a portable text file format and supports nice printing and splitting your notes into tabbed and labelled pages. % Need to know what a Linux kernel module is for? Use `modinfo modulename' or `modinfo /path/to/module'. % Need to preview PostScript or PDF files? Use gs(1) as `gs -r120x120 filename`. With PDF files, use -dFirstPage=pagenumber and/or -dLastPage=pagenumber to begin/stop interpreting on/after the designated page of the document. ghostview(1), Gnome Ghostview ggv(1) and kghostview are all popular user interfaces to Ghostscript. % New to Unix file systems? Type in `man hier' to find out a sketch of the filesystem hierarchy. % Put your signature into $HOME/.signature. This will be displayed in the lower part of the password screen presented by xlock(1). You can also tell Mozilla Mail to append this file to the email messages you send. % The bash(1) and tcsh(1) shell (but not sh(1)) support brace expansion. If enabled, you can use it to abbreviate similar commands into one or to save some typing. Examples: cp img{08,11,23}.jpg best/ mkdir -p /usr/local/{bin,etc,include,lib,man/man{1,2,3,4,5,6,7,8,9},sbin} % There are many utilities to work with Gzipped files without having to first uncompress them. They resemble other common Unix commands, but they are prefixed with a `z'. They are: zcat(1), zmore(1), zless(1), zcmp(1), zdiff(1), zgrep(1), zfgrep(1), zegrep(1). % To dump an image of an X window in a file without borders use xwd(1) (X Window Dumper) as: xwd -out win.xwd Add the -frame option if you want to include the window manager frame. Use xwud(1) (X Window Undumper) to display in a window an xwd dump file: xwud -in win.xwd % To get a line number (starting from 1) at the beginning of each line you can use: * the nl(1) filter with the -ba option * the -N option with less(1) * the -n option with cat(1) * the `set nu(mber)' command with vi(1) % To get a list of all the executables with the set-user-ID or set-group-ID bit setted along with the owner, the group and the permission of each file, use `find / -perm +06000 -ls' or `find / -perm +ug+s -ls'. % To list only files (not subdirectories) under the current directory use `find . -maxdepth 1 type f' or `ls -p | grep -v /$'. % To monitor a log file while it grows, use `tail -f filename'. -f causes tail(1) to wait for additional data to be appended to the file. Use the interrupt key (usually ^C) to exit from tail. By default the last 10 lines of the file are initially displayed. This can be changed by using the `-n number' option. % To only list directories contained inside another directory use `ls -F | grep /$' or `ls -l | grep ^d' for a long listing format. But the shortest and simplest way is `ls -d */'. % To preview a manpage type `groff -Tascii -man manpage.1 | less'. % To print the full list of colors supported by your X server type `showrgb'. % To show the Internet listening sockets for both IPv4 and IPv6 in FreeBSD use `sockstat -46l'. Under Linux use `netstat --ip -l'. % To speed up ssh on a slow connection use `ssh/scp/sftp -C -o CompressionLevel=9 ...' or put `Compression yes' and `CompressionLevel 9' in your ~/.ssh/config % To use the new anti-aliased fonts when displaying PostScript or PDF files, add the `-sDEVICE=x11alpha' option to gs(1). With ghostview(1) put `Ghostview*arguments: -sDEVICE=x11alpha' in your ~/.Xdefaults or ~/.Xresources file or add `--arguments -sDEVICE=x11alpha' on the command line. % Use the commands cksum(1) or md5(1) (FreeBSD, OpenBSD) and md5sum(1) (Linux) to verify the checksums of files. All commands accept multiple file names as arguments, otherwise take input from stdin and are useful for verification of the correctness of downloaded files. % When using the GNU Bourne-Again SHell bash(1), to redirect both the standard output and the standard error to a file or a pager like less(1), append `2>&1' to the command as in `cmd >report.log 2>&1'. Note that the order of redirections is significant: `cmd 2>&1 >report.log' directs only the stdout to file report.log, because the stderr gets duplicated as stdout before the stdout is redirected to report.log. % When using the traditional Berkeley UNIX C shell csh(1), i.e. under OpenBSD, you can enable completion by using `set filec'; then use the escape key to complete and the EOF char (usually control-D) to see a list of all the files matching the prefix typed so far. % While transferring a file using ftp(1), if your connection drops, you can resume the downloading by using the ftp `reget' command instead of `get'. The syntax of reget is the same as get: reget remote-file [local-file] % With the less(1) pager, use the -I command line option to ignore case in all searches. -i ignores case only in searches that do not contain uppercase. Both can also be set within less by typing -i or -I at the colon prompt or assigned to the LESS environment variable to make one of them the default. % Within xpdf(1) you can copy a text enclosed by a rectangle to the X selection buffer by dragging the mouse with the left button held down. Text selection won't work if the PDF document has security restrictions unless you have provided the owner password using the -opw option with xpdf(1). % You can have multiple X virtual sessions running on the same physical display, e.g. under different users and with different window managers. With startx(1) use `exec startx -- :n' to start a new session under display number :n (:0, :1, :2, etc). Use Ctrl+Alt+Fm to switch between virtual sessions, with m greater than the last text-mode virtual console available. % You can see what groups you are currently in by `groups'. `group user' will display the groups for the named user. % You can use `mplayer -dumpstream streamurl' to save an audio or video stream to a file called stream.dump for later view. Add option -dumpfile to use another destination file name. -noframedrop avoids loosing frames due to network latency. MPlayer supports most of the streaming formats and protocols used on the Internet like rtsp://, http:// and mms://. % cat(1) can be used to concatenate multiple files together. For example use `cat first.zip second.zip >archive.zip' and then `zip -F archive.zip' in order to convert a multi-part zip archive into a single-part one. This is necessary until unzip(1) will support multi-part archives. % nm(1) is the symbol-table lister. Use it to list symbols from object and executable files. E.g. you can find out external variables defined by the module (marked by the symbol type B or D if initialized) or functions as main (T) % `ps xaf' provides PID (process identification number), TTY (terminal type, associated with the process), STAT (process state code), TIME (cumulative CPU time in mm:ss used by the process) and COMMAND (command that launched the process with args) for all the processes running on a system. Option f uses simple ASCII-art to depict process hierarchy (forest). `pstree -napA' achieves similar results (tree). % `set -C or `set -o noclobber' (bash) and `set noclobber' (tcsh) prevent an already existing regular file to be accidentally overwritten by redirection of output. `>| name' (bash) and `>! name' (tcsh) can be used instead of `> name' to suppress this check. % You can use the command `php -l my_script.php' to check a PHP script for syntax errors only. % To encrypt a file with a symmetric cipher using a passphrase: `gpg -c file'. To decrypt: `gpg file'. % A simple way to change multiple file extensions is: `rename .old .new *.old'.