Unix Help File Notes
Unix Commands all ECE Grad Students Should Know
- Very basic commands (many csh or tcsh commands)
- cd
- ls -l -L -R -t -1
- history
- alias
- !<command_number>
- !<beginning characters of previous command line>
- !!
- <new_command> !$
- <command_1> | <command_2>
- <command_1> | <command_2> > <output_file>
- set
- setenv
- su
- find
- directory: .
- directory: ..
- directory: ~
- directory: /
- File handling commands
- cat
- less -Mq
- more
- tail
- head
- chmod
- chgrp
- ln -s
- File processing commands
- grep
- fgrep
- egrep
- sort
- diff
- tkdiff
- sed
- awk
- wc
- System commands
- top
- nice
- renice 19 1234
# new priority 19, PID 1234
- ps
- jobs
- kill
- <ctrl> z
# To suspend a job
- bg
# For backgrounding jobs
- df
- du
- w
- finger
- To shutdown a linux computer:
- Never ever shut down a machine unless you are sure
no one is logged in. In fact, do not reboot machines
unless it is really necessary.
It is seldom necessary to reboot.
Let support@ece know before you reboot.
The only exception is if the 110V
building power is off and the machine is running from its
UPS power supply.
- Before shutting down pizza, always check first if the proposed
time is ok with support@ece and give at least one day notice
to all users including users in other groups (e.g., Raj's).
Bringing down pizza may hang machines that mount
pizza's partitions and require that they be rebooted also.
- Type w and
finger to check
for other users.
- Type top to check
for running programs.
- Type ps -aux | less to
check for user programs.
- Shutdown the machine (results in power off for most machines)
- To shutdown machine in 3 minutes with message for any users
possibly missed, and to put reason in system log files.
sudo /sbin/shutdown -h +3
'Machine going down for [reason]'
- Use only when 110V building power is off (and machine is
running from its UPS).
sudo /sbin/shutdown -h now
'Shutting down because power is off'
- In all cases, watch the console screen for important messages.
In most cases, the machine will power off by itself. When
you are certain the shutdown is complete, press the power button
once (if off) or twice (once off, once on) to restart the machine.
- General but less common commands
- cvs
- spell, ispell
- uniq
- groups <user_name>
Good computer habits and etiquette
- Write text files (documents, code, etc.) with no more than 80 columns
of text. Many people use multiple 80-column terminals side by side and
wider columns are very annoying.
Notes on various things
Public & private key authentication with SSH.
1. Run "ssh-keygen -t rsa -b 1024", enter a password if you like.
Just press enter to have no password for authentication. This
generates two files, "id_rsa" (private key), and "id_rsa.pub"
(public key). By default these will be in "~/.ssh/".
2. Copy the the contents of "id_rsa.pub" into the file
"~/.ssh/authorized_keys2" on the remote system.
Ex: "cat id_rsa.pub >> ~/.ssh/authorized_keys2"
3. Copy "id_rsa" to "~/.ssh" on your local system if not already
there.
(Append if it's already there?)
4. Now simply login using "ssh user@host" and a password will no
longer be required unless you set a password on your key files.
(What are the "key files" and how is a password set on them?)
WARNING: Protect your private key by keeping it in a safe location.
Someone who has your private key can login as you without a password,
even if you change your password. If this happens you will have to
generate a new public/private key pair and follow these steps again.
VCL |
ECE Dept. |
UC Davis
Last update: May 27, 2011