Math with Linux
Essential Linux commands
Directories
- ls
- List files in a directory. Examples:
ls /home List files in /home. Should return a list of user directories.
ls -a List all files, including hidden files.
ls -l "Long" version of list - shows file sizes, permissions, owners, etc...
ls -lh "Human-readable" version of ls -l. Displays file sizes in Kilo/Mega/Giga byte units.
- cd
- Change directory. Examples:
cd Changes to your home directory.
cd /var/log Changes to a specific directory. This directory should contain log files.
File and directory ownership and permissions
- chown
- Change file/directory ownership. Examples:
chown joe:data somefile Changes owner to joe and group to data.
chown -R joe:data somedirectory "Recursive" version - changes owner and group of somedirectory including all of the files and subdirectories contained within.
Users and groups
adduser joe Creates a new user joe and copies files from /etc/skel/ to create Joe's initial home directory.
groups joe List groups that joe belongs to.
usermod -aG data joe Makes joe a member of the data group. (-a is for append. Without it, joe will be removed from all other groups.)
OS X
Package managers
Installing software in many Linux distributions is a breeze - simply typing aptitude install PROGRAM automatically downloads and installs the program, often in seconds. Two projects bring this same functionality to Mac OS X:
Emacs
Useful commands:
M-; Insert a comment at the end of the current line.
M-q Automatically format current paragraph to break long lines.
C-x C-c Save file.
C-x C-f Open file.
C-x C-c Exit Emacs.
Video
Playing encrypted DVD's. By default, Debian and Ubuntu do not contain DVD decryption libraries. To play encrypted DVD's, you will need to install libdvdcss2. This is available by adding the following line to /etc/apt/sources.list:
Debian: deb http://www.debian-multimedia.org squeeze main non-free
Ubuntu: deb deb http://packages.medibuntu.org/ karmic free non-free
After adding the line to the configuration, run sudo aptitude update & sudo aptitude install libdvdcss2.
Networking
Setting up dhcp hostnames. In order to send the host name when connecting to the network, edit /etc/dhcp/dhclient.conf'. Add a new line with send host-name "my-hostname";, changing my-hostname` to your own host name.
Package management
galternatives
gkdebconf
Viewing Documents
Changing default pdf viewer: The default viewers for various file types are configured in the file `/etc/mailcap'
