Spring Unix
Conference
UNIX - Basic Commands
The basic form of any UNIX command is:
command_name options argument(s)
- Unix is case-sensitive.
- Unix distinguishes between upper and lower case letters in the names of
files and programs. Thus, while ls is a valid Unix command, LS is not.
- Login names and passwords are also case-sensitive.
- A filename in Unix can consist of any combination of characters on the
keyboard except for the space bar and all of the following : * ? ! \ \ ‘
“ > ;, ^ ( ) $ ~. These characters cannot be used in filenames because
they have special meaning to the shell. For instance, the first two
characters are used as “wildcards”.
- Some programs, such as Pico, have their own commands that you type within
the program rather than at the Unix shell prompt. The Shell prompt reappears
whenever you exit those programs.
- If by any means any of your commands do not work, than please visit the
following websites.
File and Directory Handling Commands
- ls: Lists your files
- ls –l: Lists your files in ‘long format’, which information such as
the exact size of the file, who owns the file, who has the right to look at
it, and when was it last modified.
- ls –a: List all the files, including the ones whose filenames begin in a
dot, which you do not always want to see.
- mv file1 file2: Moves a file into a different directory, or renames the
file.
- cp file1 file2: Copies a file
- rm filename: Removes a file. Preferably use rm –i which will ask you for
confirmation before deleting the file
- wc filename: Tells you how many lines, words, and characters there are in
a file
- chmod option file: Lets you change the read, write, and execute
permissions on your files. chmod o+r filename will make the file readable
for everyone, and chmod o-r filename will make it unreadable for others.
- mkdir dirname: Make a new directory
- cd dirname: Change directory. You can basically go to another directory
and can view the files in that directory
- pwd: Tells you which directory you are currently browsing.
Printing Commands
- lpr filename: Print. Use the –P command to specify for the printer name.
For printing in TAMU CS Department, please refer below.
- lpq: Check out the printer queue. This can be used to get the number
needed for removal, or to see how many other files will be printed before
yours can come out
- lprm jobnumber: Remove a job from the printer queue. As mentioned above,
you can find the job number using lpq.
- To print Duplex: type
ppr-Pps210 -twosided filename
About Yourself and Other People
- whoami: Returns your username. This command can be used to find out if
someone is already logged on and had forgotten to log out.
- ps –u yourusername: Lists your processes. Contains information such as
the process ID, which you might need to kill a particular process which
would be creating difficulties on your computer
- kill processID: Ends the process, whose process ID you typed in.
- quota –v OR zquota: Show what your disk quota is, how much you’re
using, and incase you have exceeded your quota.
- du filename: Shows the disk usage of the files and the directories in
filename, du –sk will give a total of all files and directories on the
disk
- last yourusername: Lists your last logins.
- finger username: Gives you lots of information about that user, e.g. when
they last read their mail and whether they’re logged in.
- w: Tells you who’s logged in, and what they’re doing.
- who: Tells you who’s logged on, and which computer they are logged on
to..
- last –1 username: Tells you when the user last logged on and off and
from where.
- talk username: Lets you have a typed conversation with another user
(primitive chat service)
- write username: Lets you exchange one line messages with another user
(primitive chat service)
Mail and Connection Commands
- mail: By typing this into your Unix shell prompt it will give you a list
of mail on your account. All you need to do is type in the mail number on
the mail prompt and it will open up
- pine: Basically the same function as the mail command, but with a better
user interface
- rlogin hostname: Lets you connect to a remote host
- telnet hostname: Lets you connect to a remote host. Use rlogin whenever
possible
- ftp hostname: Lets you download files from a remote host which is set up
as an ftp-server
The commands mail and pine(see pine handout) are programs that run to check
your mail and thus they will have their own commands and ways to maneuver
inside. A hostname will look something like a web address (e.g.
unix.tamu.edu).
Miscellaneous Commands
- date: Shows the current date and time
- cal: Shows a calendar of the current month. If you type in cal 10 1995 you
will get the calendar for the moth of October in the year 1995.
- man commandname: Shows you the manual page for the command
- clear OR Ctrl + l: Refreshes or clears your screen.
- Ctrl + c: Stops running program or the command
- Ctrl + p: Retrives the last shell command you typed
- Ctrl + z: Suspends the currently running program or command
- exit: Ends your SSH session.
More information on almost any of the commands that have been mentioned
above or you know of can be found in the online manual pages. Type man
commandname at the shell prompt to look a the manual page for that particular
command