Newniks: Tips for new Unix users

Cautionary
From xkcd.com
Debian orphaned projects
From xkcd.com
The term Unix is used here to refer to operating systems in the family of UNIX, OSF, GNU/Linux, FreeBSD, Mac OS X, etc.

The Art of Unix Programming by Eric Steven Raymond (2003) is a very interesting overall introduction to Unix.

This page is based on information that I started putting together for myself in 1991, as I started learning Unix (and csh) after years of using VMS. It started as a simple list of Unix equivalents for VMS commands but has grown somewhat beyond that. It is still intended mainly as an aide-mémoire for myself. Debian.org For historical reasons, there may remain an indiscriminate mix of OSF and Linux (especially Debian GNU/Linux), and of the csh and bash shells.

Miscellaneous links (I don't actually make much use at all of these sites except for the Debian one):


The following sections are intended to be in order of increasing sophistication of the task. At the right is a table of contents with the section names sorted alphabetically. For Unix under MS Windows, see Cygwin & MinGW below.

1. Installation

These brief notes are for installing Debian GNU/Linux. See the Debian Web site for more details. These notes are no substitute for the real documentation.

1.1 Creating a Debian CD or DVD

Debian CD and DVD image files can be downloaded from debian.org.

Jigdo (‘jigsaw download’) is an application that downloads pieces and constructs the final image file. It allows restarts in case of download failures, and allows upgrading a CD image. Jigdo is available for several operating systems. Under MS Windows, once you have downloaded and unzipped jigdo, double-click on jigdo-lite.bat. This will open a command-line window. When prompted, enter the URL of the CD that you wish to download, e.g.,
http://cdimage.debian.org/debian-cd/7.6.0/amd64/jigdo-cd/debian-7.6.0-amd64-CD-1.jigdo.
When prompted, enter the URL of an appropriate Debian mirror site, e.g., ftp://ftp.ca.debian.org.
Be prepared to wait a while (e.g., 50 minutes over a cable connection) for the actual downloads to occur.

See Firmware for a discussion of how Debian handles non-free firmware, which may be required at installation time for some hardware (e.g., certain network drivers). Some Unofficial non-free images including firmware packages are available.

1.2 Installation procedure

For most of the questions asked during installation, either you can just accept the defaults or the appropriate answer is fairly obvious.

When installing under VirtualBox, the best answers for host name and domain name are not obvious to me, but they may not matter very much under many circumstances.

1.2.1 sudo and root

When asked to enter a password for the ‘root’ user, it is better to just leave it blank. (In at least some Debian versions, if you specify a root password then the sudo command will not be installed, or at least you won’t be added to the list of users who can use it. Since it is better to use the sudo command than to become the root user when you need to do things that require special privileges, you do want to be able to use sudo.)

If you do specify a root password, you can later add yourself to the sudoers list.

If you don’t specify a root password here, the root account will be disabled. If you later do need a real root password (e.g., to get into recovery mode when booting) you can set one.

1.2.2 Disk setup

The default Guided - Use entire disk and All files in one partition are reasonable choices. The installer gives you several chances to change your mind about this choice, which is quite important. In most cases you can accept the default choices until the last step, when you must select Yes to actually do the disk setup. (When installing under VirtualBox, these choices are much less critical because it’s installing the guest on a virtual disk, not on the computer’s real disk.)

If you are installing Linux onto a computer that will also be running another operating system, things are more complicated and are not dealt with here; the wrong choices can lead to owning a very expensive paperweight. See Debian's Pre-Partitioning for Multi-Boot Systems, for example.

1.2.3 Mirror

Once the base system has been installed, you are asked to specify whether you want to use a ‘network mirror’ to ‘supplement the software that is included on the CD-ROM’. You should probably say yes, since use of a mirror will give you access to extra software, including a selection of several ‘tasks’ and desktop environments in addition to the standard desktop environment and system utilities. For example, Iceweasel (Firefox) and GIMP are on CD 1; LibreOffice and Inkscape are not but are installed if a mirror is specified.

If you do not choose a mirror, only things that are on your CD or DVD can be installed, some may be out of date, and you won't get any security updates. Later you will probably need to specify the use of a mirror for installing additional software. That can be done by using a text editor (e.g., nano, which is on the first Debian CD) to add the mirror specification to the file /etc/apt/sources.list. (The programmes software-properties-gtk or synaptic could be used but they are not on the first CD.)

1.2.4 Desktop environment and tasks

If you specify a mirror, in the next step you can specify which graphical desktop environment you want (they’re very big but you probably want one) and which other tasks you want, in addition to the standard system utilities.

Application names in GNOME and MATE:
Application GNOME MATE
Window manager Metacity Marco
File manager Nautilus Caja
Text editor Gedit Pluma
Graphics viewer Eye of GNOME Eye of MATE
Document viewer Evince Atril
Archive manager File Roller Engrampa
Terminal emulator GNOME Terminal MATE Terminal

I recommend the MATE desktop environment. It is a continuation of GNOME 2, avoiding the many dubious design decisions that went into GNOME 3. (My software seems not to work well under GNOME 3, at least under VirtualBox, but works fine with MATE.)

At this point you may be asked to put your CD in the drive; if you don't really have one (e.g., you installed in VirtualBox using a CD image) select Abort and it will download things entirely over the Internet from the mirror you specified earlier, without the CD. To avoid the request for a non-existent CD, you may need to edit the file /etc/apt/sources.list to remove (or comment out) the line corresponding to the CD.

The subsequent download and installation process may take a long time, depending on the speed of the network and the speed of your computer.

If necessary, you can subsequently install a graphical desktop environment by giving the command sudo aptitude. Within aptitude, use the down arrow and Enter key to select Tasks ► End-user and then, for example, MATE desktop environment. Type + to say that you want to add the packages, then g to say you want to get it, and then g again to really get it.

Instead of aptitude you can also use Synaptic. Do a search for mate (making sure that Look in specifies Name rather than Description and Name).

1.2.5 Installing a boot loader

You will generally want to install the Grub boot loader in your Master Boot Record, unless you have special needs. (When installing under VirtualBox, you can go ahead and let the boot loader be installed in the MBR without fear, because it's just happening in your virtual disk.)

1.3 After installation

Things that I personally do after installation of the standard MATE desktop environment (and ssh and Web servers if desired):

1.3.1 Notes on desktop when upgrading to Wheezy (Debian 7)

I started writing here about how I customize settings in GNOME 3 but then discovered that I couldn't. GNOME 3 and its default Adwaita theme are abominations. One could perhaps switch back to GNOME 2, or try MATE (a fork of GNOME 2) or Xfce.

In the meantime, make sure that the gnome-session-fallback package is installed, then when logging in select GNOME Classic rather than GNOME or System Default.

Also, install the clearlooks-phenix-theme package. It is ‘a GTK3 theme which is a port of Clearlooks, the default theme for GNOME 2’. Once installed, go to Applications ► System Tools ► Preferences ► Advanced Settings (or Tweak Tool with package gnome-tweak-tool installed) and select Clearlooks-Phenix for the GTK+ theme and the Window theme.

The gnome-tweak-tool package is supposed to allow ‘the adjustment of several advanced GNOME options that can’t be configured in gnome-control-center’ (see live.gnome.org/GnomeTweakTool). I haven't got it to work yet, it just spews out error messages then brings up the standard Advanced Settings dialogue.

Changing the date format to year-month-day should be easy but isn't in GNOME 3. See Chris Collins' post for one approach.

The command dconf-editor may provide some additional possibilities for customization.

To add a programme to the launch panel at the top of the screen do Alt RightClick on the panel.

To change whether windows are grouped or not in the taskbar at the bottom of the screen, RightClick at the extreme left of the taskbar, up against the edge of the screen, which gives the possibility of bringing up a Preferences window.

If the GNOME settings get hopelessly mangled, you may get a ‘Something has gone wrong’ message with no alternative but to log out, log back in and get the same message again. (This happened to me when I tried to move the bottom GNOME panel to the left side of the screen.) dconf-editor in the dconf-tools package is a GUI tool for editing the configuration of GNOME but it won't be usable if your GNOME GUI isn't usable. User configuration settings are in various places, including ~/.gconf/ and ~/.config/dconf/user. I recovered a working configuration by doing Ctrl-Alt-F1 to get to a text console and replacing the latter file with a backup version (called user.something) that was in the same directory. I had also deleted ~/.gconf/ and everything in it, but that in itself didn't help.

1.3.2 Notes on desktop when upgrading to Jessie (Debian 8)

In Jessie, GNOME 3 is more offensive than before, with the GNOME Classic very much changed. I have installed MATE (package mate-desktop-environment), the continuation of GNOME 2.

1.4 Software packages

This is the beginning of trying to understand the various package-management tools for installing and removing software that Debian provides. The CD numbers below are all for the amd64 CD's.

Applications ► System Tools ► Add/Remove Software invokes gpk-application; available when Debian desktop (GNOME) is installed from CD without mirror.

To control the list of sources to use when installing packages:

I haven't yet figured out how to add or change a mirror, based on what is available on CD 1, without using a text editor. apt-mirror-setup is what is used during installation but it not supposed to be (cannot be?) used outside the installer.

The Debian CD search engine can be used to find out which CD a particular package is in.

2. Command-line editing

See 'man cmdedit'. Non-default key bindings are defined in ~/.bindings

If command-line editing doesn't work (e.g., arrow keys produce stuff like ^[[A) check whether the current shell is sh and change it if necessary.

3. Wildcards and patterns

The pattern matching implemented in shells has some similarities to, but is not the same as, the use of regular expressions.

3.1 Pattern matching in the bash shell

Simple wildcards:

Use the built-in bash command shopt -s extglob to turn on extended patterns. Then, for example, ls *.*(cpp|h|ui) will list all .cpp, .h and .ui files.

3.2 Regular expressions

grep uses regular expressions. By default it understands basic regular expressions. To use extended regular expressions, use grep -E or egrep.

For example, to find lines of the file test.txt that contain either ‘aaa’ or ‘bbb’, use the command grep -E 'aaa|bbb' test.txt

4. File management

4.1 Making and deleting directories and files

If using the command line rather than a GUI:

4.2 Directory listings

Each file has 3 timestamps associated with it:

The ls command displays the mtime by default, but can be asked to list the atime (-u) or the ctime (-c) instead. If you want to display more than one of the timestamps at the same time, you can use stat or find; for example,
stat -c %x,%z,%n *
find ./ -printf "%Ab %Ad %AH:%AM\t%Cb %Cd %CH:%CM\t%P\n"

The touch command can be used to change the mtime to whatever you want (simultaneously changing the ctime to the current time). For example,
touch -t [[CC]YY]MMDDhhmm[.ss]

4.3 Finding files

5. Privileges

When superuser privileges are required, use sudo rather than logging in as the root user (e.g., using the su command), to avoid accidents.

A user can be given the sudo privilege by adding their username to the file /etc/sudoers or by adding them to the sudo group with the command
usermod -a -G sudo username
This must be done as superuser (i.e., after giving the su command and the root password). The user must log out and back in again for this to take effect.

When using sudo you can't access built-in shell commands like cd (ref). This can be worked around by doing sudo bash, sudo -i or sudo su. You should exit from the resulting privileged shell as soon as possible.

Note that su stands for ‘subsitute user’ and not ‘superuser’, since the command can be used for temporarily becoming any user, not just root.

If you need a real root password (e.g., to get into recovery mode when booting) and have not set one or do not remember it, you can use the command sudo passwd root to set it. If for some reason you cannot get logged in to use the sudo command, you can follow these instructions (e.g., ref):

6. Background processing

6.1 Running after logout

The '&' at the end of a command provides background processing that continues after logout. The 'nohup' command can be used to ignore hangups, but is necessary only to ignore explicitly sent hangup signals, since the '&' effectively protects a process from being sent a hangup signal upon logout.

6.2 Reduced priority

The 'nice' command (a different 'nice' command is built into csh) can be used. However, it may not be necessary: in 'UNIX for VMS Users' (Bourne, 1990) it says that 'in most versions of Unix the shell automatically lowers the priority of processes running in background for a system defined period of time' (p. 818), although I haven't found further details about this. The 'renice' command can be used to lower the priority of an already-running job. Note the stupid convention that the 'priority' parameter increases with decreasing priority.

6.3 Scheduling

The at command provides scheduled running of a process. The related batch command runs jobs when the average system load level falls below some specified value. The jobs are run using the sh shell.

cron is a dæmon for executing scheduled commands. It searches its spool area (/var/spool/cron/crontabs) for crontab files, which are named after user accounts, and runs them; these crontab files should be set up using the crontab command. cron also processes the file /etc/crontab, which in turn invokes any files in /etc/cron.hourly/, /etc/cron.daily/, /etc/cron.weekly/ and /etc/cron.monthly/. (One can also put crontab files in /etc/cron.d/ but this is deprecated.)

6.4 Notification

Shell provides notification when background process terminates. Normally notification is given just before the system prompt reappears. The shell variable 'notify' (or the 'notify' command) will cause notification to be immediate.

6.5 Queue management and distributed processing

Torque (Debian packages torque-*) and Grid Engine provide facilities for queue management on a single machine or more generally across distributed machines. The Grid Engine project, formerly developed by Sun, has now split into a commercial project (Univa) and two competing open-source projects, Open Grid Scheduler and Son of Grid Engine. Before the split, Debian included the packages gridengine-* for the Sun product, but as of 2015 May 9 the situation in Debian is unclear to me.

gridengine.org is said to be a useful resource.

Globus (Debian packages globus-*) provides facilities and tools to help researchers ‘move, manage, and share big data’.

7. Linking

Linking is the process of linking a compiled programme together with its libraries. It may also be referred to as building, and in Unix it is done by ld, the loader. In the case of shared libraries, the linking must take place both at link (build) time and at run (load) time.

The linker ld has a built-in search path for finding required libraries. The default search path seems to include only /lib/ and /usr/lib/. A directory can be added to the default search path by adding it to /etc/ld.so.conf and then running ldconfig. The command ldconfig -v can be used to see what libraries ld is aware of.

One can also specify additional search directories on the ld command line using the -L and -R flags.

There is also a mechanism involving the environment variables LD_LIBRARY_PATH (deprecated except for temporary kluges) and LD_RUN_PATH. See Russ Allbery's Shared library search paths for a good discussion.

The purposes of the various directories like /lib/ and /usr/lib/ are specified in the Filesystem Hierarchy Standard.

8. Debugging

The following are commonly used commands within dbx:
run Run from beginning. Command-line arguments can be included as they would be when invoking the programme from the shell. Redirection of stdin and stdout can also be included in the usual way.
next (n) Execute one line (do not enter procedures)
step (s) Execute one line (do enter procedures)
stop in proc Stop when procedure is called (set breakpoint)
stop at line Stop when given line in current procedure is reached (set breakpoint)
delete all Delete (disable) all breakpoints, trace events and record events
cont (c) Continue
return Execute until return from procedure
list (l) n1,nl Lists lines in the current source file
print (p) expr Print value of expression
where (t) Display list of active procedures
use dir Sets list of directories searched for source files (~ not supported, so must specify, e.g., /usr/users/name/src rather than ~name/src; separate paths by spaces)
quit (q)  

9. Make

Running make recompiles only routines modified since the last make. In order to recompile everything, must use touch to fake the modification dates(!).

10. Environment & shell variables

10.1 Environment variables

setenv to display all environment variables
setenv NAME value to define an environment variable
unsetenv NAME to undefine an environment variable
set to display all shell variables
set name=value to define a shell variable
unset name to undefine a shell variable

The shell variables user, term, home & path are automatically mirrored in the environment variables USER, TERM, HOME & PATH.

10.2 Aliases

alias cmd str to define a new command
unalias cmd to undefine a command

Environment variables & aliases may be def'd in .login or .cshrc

The mv and cp commands by default will overwrite existing files without warning. It is prudent to define aliases which invoke the -i flag, which causes a prompt before overwriting. With csh under Tru64 Unix, the -i in the alias can be overridden just by giving the command cp -f. With tcsh under Debian Linux, this doesn't seem to work, but the alias substitution can be avoided by giving the command \cp.

Note a nasty way of messing up using the cp command: if you say, e.g., cp *.dcl instead of cp *.dcl ., and if there are exactly 2 .dcl files, it will copy the first over the second without warning that the syntax is wrong.

11. Fonts

This sample set of font specifiers includes all combinations of serif or sans serif, medium or bold, upright (roman) or oblique (italic), and proportionally spaced or monospaced (fixed pitch):

-*-times-medium-r-*-*-fontsize-*-*-*-*-*-iso8859-1
-*-times-bold-r-*-*-fontsize-*-*-*-*-*-iso8859-1
-*-times-medium-i-*-*-fontsize-*-*-*-*-*-iso8859-1
-*-times-bold-i-*-*-fontsize-*-*-*-*-*-iso8859-1
-*-courier-medium-r-*-*-fontsize-*-*-*-*-*-iso8859-1
-*-courier-bold-r-*-*-fontsize-*-*-*-*-*-iso8859-1
-*-courier-medium-i-*-*-fontsize-*-*-*-*-*-iso8859-1
-*-courier-bold-i-*-*-fontsize-*-*-*-*-*-iso8859-1
-*-dejavu sans-medium-r-*-*-fontsize-*-*-*-*-*-iso8859-1
-*-dejavu sans-bold-r-*-*-fontsize-*-*-*-*-*-iso8859-1
-*-dejavu sans-medium-o-*-*-fontsize-*-*-*-*-*-iso8859-1
-*-dejavu sans-bold-o-*-*-fontsize-*-*-*-*-*-iso8859-1
-*-dejavu sans mono-medium-r-*-*-fontsize-*-*-*-*-*-iso8859-1
-*-dejavu sans mono-bold-r-*-*-fontsize-*-*-*-*-*-iso8859-1
-*-dejavu sans mono-medium-o-*-*-fontsize-*-*-*-*-*-iso8859-1
-*-dejavu sans mono-bold-o-*-*-fontsize-*-*-*-*-*-iso8859-1
Screenshot of xfontsel

For a serif font, italic is indicated by -i-; for a sans-serif font, oblique is indicated by -o-.

The DejaVu fonts are an extension of the very high-quality Vera fonts.

Use xfontsel, xlsfonts or xfd (all in package x11-utils) to explore available fonts.

Fonts in Debian (2017)

12. Tar

Example of using tar to transfer files from VMS:

    On VMS:
      $ FUN TAR
      $ FUN TO GUT
      $ VMSTAR_U cvf GUT_FOR.TAR *.FOR
    On OSF:                     On VMS:
      % cd gut
      % ftp funvie                $ FTP PALACE
      ftp> cd fun_gut             FTP>SET DEF "gut"
      ftp> image                  FTP>SET TYPE IMAGE
      ftp> get GUT_FOR.TAR        FTP>PUT GUT_FOR.TAR
      ftp> quit                   FTP>EXIT
      % tar xvf GUT_FOR.TAR 

13. Scripts

A script is invoked by typing its name, like any other command.

A csh script must start with a comment (#) in order to be recognized when invoked directly. (It's unnecessary if it's invoked with a csh or source command.)

Script files must be made executable, e.g. chmod u+x name.

14. Shells

14.1 Alternatives

To find out which shell is being used, look at the $SHELL environment variable (e.g., echo $SHELL).

Use chsh to change the default shell for a user (e.g., chsh -s /bin/bash).

The following are alternative Unix shells. (References: John Shepherd's notes from 2004; Sven Mascheck's notes; Wikipedia article.)
Bourne-shell family
sh Steve Bourne early 70's the original Unix shell uses .profile
Rsh     Restricted version of Bourne shell  
ksh David Korn early 80's like sh + functions, history editing, ...  
ash Kenneth Almquist late 80's small and fast version of sh  
zsh Paul Falstad late 80's like ksh but many, many enhancements  
bash Ramey/Fox early 90's like ksh with extras; default Debian interactive shell uses .bashrc & .bash_profile
dash Herbert Xu, Debian late 90's POSIX; default Debian /bin/sh shell  
C-shell family
csh Bill Joy late 70's original C-syntax shell, + job control, history uses .cshrc & .login
tcsh Ken Greer early 80's like csh + extra interactive features  
rc Byron Rakitzis early 90's even more C-like syntax, from Plan-9  

14.2 Login scripts

The following is a simplification.

14.2.1 sh (Bourne shell)

sh executes ~/.profile when started.

14.2.2 csh (C shell)

csh executes ~/.cshrc when started, then executes ~/.login if invoked as a login shell.

14.2.3 bash (Bourne-again shell)

As a login interactive shell, bash executes ~/.bash_profile, ~/.bash_login or ~/.profile.
As a non-login interactive shell, bash executes ~/.bashrc (which is typically also executed early by ~/.bash_profile). (Environment variables that are exported in .bash_profile will be inherited by a subsequent non-login shell; aliases are not inherited and so are typically defined in .bashrc.)
As a non-interactive shell, by default no files are executed.

The GNOME terminal-window application, by default, does not run as a login shell, so it inherits things from the initial GNOME login. This means, for example, that, if ~/.bash_profile is modified, the changes won't take effect if you just invoke a new terminal window; you'll need to actually log out and back in to your GNOME session. Similarly, if you initially don't have a ~/bin/ directory and then create one, you'll have to log out and back in for it to show up in your PATH. This behaviour can be changed by checking the Run command as a login shell box under the Command tab, accessed by doing Edit ► Preferences ► Profiles and Edit or by doing Edit ► Profile Preferences.

15. Network setup

To set up a fixed IP address for an Ethernet connection, use System ► Preferences > Internet and Network > Network Connections. (If this item doesn't appear in the menu, make sure the package network-manager-gnome is installed.) In the Wired tab, select an existing connection and click Edit, or click Add. In the box that pops up, go to the IPv4 Settings tab. Under Method select Manual. Enter the IP address that has been assigned (e.g., 132.206.111.nnn). Enter the netmask (e.g., 255.255.255.0), the gateway address (e.g., 132.206.111.1, the IP addresses of some DNS servers, and the name of a domain to be searched (e.g., campus.mcgill.ca).

Add the line ALL: ALL to the file /etc/hosts.deny and set up /etc/hosts.allow appropriately.

Logins from machine to machine should be done using ssh (in the ssh-client package). If you can't connect to a machine, make sure the ssh-server package is installed on that machine.

When you connect to a remote computer the first time, you'll be asked to confirm its ‘RSA host key’. If its key subsequently changes (e.g., when its operating system is reinstalled) you'll get an urgent-sounding warning. One way to deal with it is to give the commands
ssh-keygen -R hostIP
ssh-keygen -R hostname
where hostIP is the IP address of the remote computer (e.g., 123.456.789.123) and hostname is its name (e.g., name.dept.mcgill.ca). This removes the key from ~/.ssh/known_hosts, and then you'll be asked to confirm the new one when you try again to connect.

16. Telnet & FTP

telnet:
  Use  set escape '^@'  to change escape character.
ftp:
  Transferring multiple files:
    In Unix:
      Use mget & mput; invoke ftp with -i to disable prompting.
      Use ;0 with mget from VMS if only latest versions are desired
        (version numbers will appear in Unix filenames as ;n).
      Attempting to mget/mput large numbers of files will cause
        errors creating data sockets.
    In VMS:
      Use GET/PUT with wildcards; /NOCONFIRM is default.
      Use ;0 with mput if only latest versions are desired
        (version numbers will appear in Unix filenames as .n).
      Large numbers of files can be transferred without errors
        (it pauses occasionally, perhaps to clean up sockets).

17. System administration

17.1 Mail

To change limit on message size, edit MaxMessageSize= in /var/adm/sendmail/sendmail.cf . (Funsan receives mail but puts it into INBOX's on Cortex, so the message size limit depends on the limit set on Cortex.)

17.2 System logs

System logs are stored in or under /var/log/. User-space (non-kernel) boot-time messages are not logged by default; to enable them, install package bootlogd.

To roll over the system log /usr/var/adm/binary.errlog (which can be read using uerf) do

where pid is the process ID of the binlogd daemon, obtained by doing ps auxw|grep binlogd (or looking at /var/run/binlogd.pid). This will rename the current log file to /usr/var/adm/binlog.saved/binary.errlog.saved and start a new version of the log file. You should first rename any old saved log in order not to lose it.

17.3 Web-server logs

To roll over the Web-server logs, do the following as su in /usr/local2/etc/httpd/logs:

where pid is the process ID of the httpd daemon, obtained by doing ps auxw|grep httpd (or looking at httpd/logs/httpd.pid). The -1 flag invokes the HUP signal, causing a restart. Note that csh has its own kill command so /usr/bin/kill is used to get the standard one. (-HUP and -1 are equivalent in the kill command. See /usr/include/signal.h .)

17.4 Finding out what's going on

Debian version names, release dates of ‘stable’ versions [refs 1, 2, 3]
and Long Term Support dates

17.5 Start up

The /sbin/init programme initializes the system by creating and controlling processes.

On Funsan, the system is considered to run at one of four run levels:

On Fundus, there are run levels 0-6 plus s (or S). (In fact, 7-9 are also possible.) Run level 0 is to halt the system, 1 is single-user mode (s is related to 1), and 6 is for rebooting. The processes run by init at each run level are defined in the /etc/inittab file.

For each run level n, a directory rcn.d/ contains links which point to scripts in init.d/. On Funsan the rcn.d/ and init.d/ directories are in sbin, on Fundus they're in /etc/.

On Funsan, there are scripts /sbin/rcn for bringing the system to level n. I don't know how (or if) they're used, or if they also exist on Fundus.

17.6 Login

When users log in, the welcome message is taken from /etc/motd ('message of the day').

18. Cygwin & MinGW

Cygwin and MinGW provide environments for running *n*x under Microsoft Windows. See Software I like: Cygwin and MinGW.

19. X and GUI’s

The X Window System (often called X11) is a client-server software system that provides low-level functions from which to build graphical user interfaces (GUI’s) and applications for either networked or local computers.

In contrast to the usual usage of local clients and remote servers, the X11 client is the computer (possibly remote) on which the graphical application is running, and the server is the local computer on which the display occurs.

To run a programme remotely and have its display appear on your local computer, just use the -X option with your ssh command when logging in to the remote computer. (This assumes that both computers are running Unix.)

Notes about display managers (login managers): Under Debian, the default display manager is shown in the file /etc/X11/default-display-manager and the actual display manager being used can be seen by doing
systemctl status display-manager.

The Unix GUI consists of

The MATE desktop environment is a continuation of GNOME 2, for those (like me) who don't like the direction GNOME 3 went in to copy Ubuntu’s Unity desktop environment and become ‘modern’ (and more like Mac OS X?). Unity is not available in Debian, and Ubuntu 18 will be switching back to GNOME (ref). KDE's desktop environment is Plasma.

Metacity is a light-weight window manager and was the default window manager for GNOME 2; Marco is its continuation under MATE. As of 2017 Jun, Compiz is already available as an alternative to Metacity in Ubuntu and will be in Debian 9 (stretch) when it comes out soon. Compiz makes use of OpenGL for fancy (gimmicky?) 3-D effects.

Matt Chapman’s guide to window managers for X seems to have stopped being updated before the introduction of the abomination that is GNOME 3, and thus before MATE.

Wayland ‘is intended as a simpler replacement for X’ and ‘GNOME and KDE are expected to be ported to it’.

The original low-level method of accessing the X protocol for client-side programming is Xlib (libX11). A newer method is XCB (libxcb), which was started in 2001. Since 2010, libX11 has only been implemented on top of XCB, and calls to both can be mixed (ref).

20. Backups

Resources for Amanda:

21. VMS/Unix equivalents

VMS commands for which Unix equivalents are given:
copy, create, define, del, diff, dir, dump, help, inquire, lo, rename, search, set, show, submit, type

21.1 copy

COPY in out cp in out
COPY hname"x y"::in out dcp hname/x/y::'\''in'\'' out

21.2 create

CR/DIR [.dname] mkdir dname

21.3 define

set or setenv

21.4 del

DEL fname rm fname
DEL fname/CONFIRM rm -i fname
DEL fname/LOG rm -e fname
DEL [...]fname rm -r fname (-f to override protections)

21.5 diff

DIFF file1,file2 diff file1 file2
DIFF file1,file2 cmp file1 file2 (1st difference only)

21.6 dir

DIR ls
DIR/SIZ/DAT/OWN/PROT ls -l
DIR SYS$LOGIN ls ~/
DIR .* ls -a
DIR [dname...] ls -R /dname
DIR [dname...]fname* find /dname -name fname\* -print
DIR [dname...]/SIN/SIZ/DAT find /dname -fstype ufs -mtime 1 -ls
DIR [000000...]/SIZE/TOTAL du -x / (-k for kbytes)
DIR [...]/SIZE/GRAND_TOTAL du -s .

Fields in -l directory listing: type, protection, no. links, owner, group, size, date, name.

Date shown is date modified; -lu for date used, -lc for date created.

21.7 dump

DUMP od -b displays bytes in octal
od -a displays bytes as ASCII names
od -c displays bytes as characters
etc., etc.

21.8 help

Example man page
Source: xkcd.com
HELP command man command
(HELP keyword man -k keyword)

21.9 inquire

INQUIRE/NOPUNCT var "text" echo -n text; set var = ($<)

21.10 lo

LO logout

21.11 rename

RENAME oldname newname mv oldname newname

21.12 search

SEARCH fname "string" grep -i 'string' fname
SEARCH/EXACT fname "string" grep 'string' fname
SEARCH [...]*.* string find ./ -name \* -exec grep string {} \;
or find ./ -name \* | xargs grep string

21.13 set

SET DEF [dname] chdir /dname
SET DEF [.dname] chdir dname
SET DEF [-] chdir ..
SET DISPLAY/CR/NODE=nodename setenv DISPLAY nodename:0
SET FILE fname/ENTER=alias ln -s fname alias
(note different behaviour if fname is a directory name (ref))
SET FILE fname/own=[uic] chown username fname
SET HOST hname dlogin hname
SET PASSWORD passwd
SET PROC/PRIV=SYSPRV su (or login as root on console)
SET PROTECTION=() fname chmod ugo-+=rwx fname
SET PROTECTION=()/DEFAULT umask mask (e.g. 022)
SET TERM/[NO]BROADCAST biff y/n (turns mail notification on/off)
SET TERM ... stty ...
SET TIME=dd-mon-yyyy:hh:mm:ss date yymmddhhmm.ss

21.14 show

SHOW DEF pwd
SHOW DEV D more /etc/disktab partition c = whole disk
partition a = 64 Mbyt
partition g,h = rest of disk
df -t ufs (disk free)
SHOW LOG *, SHOW SYMB * env or printenv
SHOW MEMORY free
vmstat
grep Mem /proc/meminfo
lshw
SHOW TERM stty
SHOW TIME date
SHOW USERS who
SHOW SYSTEM ps auxw
show installed s/w /usr/sbin/setld -i

21.15 submit

Facilities for background processing in Unix are quite different from the VMS submit command.

21.16 type

TYPE/PAGE name more name

R. Funnell
Last modified: 2018-08-18 11:43:57