login:
Enter your username (in lowercase letters) and press Return. You will then be prompted for a passoword:
Password:Enter your password and press Return.
%
$
#
You should see either one of the above shell (csh/tcsh/bash/ksh) prompts when login from a console that does not start up with X window systems. Note: Typically a # prompt indicates that you login as a super user which is discouraged to do so, unless you need to do system work. If you login from a GUI (X window systems), you get a task bar. You can invoke a console session, and you will see the above shell prompt.
To logout from a workstation, enter exit from a session. When
X is running, you may use the 'start' button for logoff.
To change your password,
enter: passwd which will ask you to enter your old and new passwords. You may wnat to backup the password files before making any changes:
drwx------ 2 klai adm 1024 Jan 6 08:01 mail drwxr-xr-x 2 klai root 1024 Sep 9 07:01 mlt drwx------ 2 klai adm 1024 Aug 16 1999 nsmail -rw-r--r-- 1 klai users 1921 Nov 15 08:25 .cshrc -rwx------ 1 klai users 1921 Nov 15 08:25 bin/myCmdr: read
Note: run man chmod and man ls for details regarding file modes.
These commands are for text file only. (e.g. cat myFile) If you accidentally cat a non-text file (like a binary file), you will get a lot of garbage and your terminal may hang. If you're not sure what the type of a file is, use the "file"
Subcommands in less:
SPACEBAR Moves forward one screenful Return Moves forward one line b Moves back one page /word Return Search forward for word q or CTRL-c Quit h Help
The less command is a UNIX filter; many other UNIX commands filter their output through less. Instead of processing the output directly, it is sent through less which gives you more control. In UNIX terms, we say that we "pipe the output through less". When you enter a command and its output is too large to fit on one screen, you can cancel the output by typing CTRL-c and re-enter it as follows:
% command | lessor
% !! | less
Note: !! stands for repeat previous line under csh/tcsh/bash environment.
UNIX doesn't verify the deletion, it just deletes the file
and prompts for the next
command. You can specify more than one file to be deleted on the
command line by separating the filenames with blanks. You can
also, with caution, use wildcards
(* ? [ ]
)
to delete groups of files. The
most catastrophic mistake you could probably make would be to enter
rm * which would delete all of the non-hidden files in
your current directory. Please note that there are no "undelete" utilities
available in UNIX, so once you have deleted something, it's gone(pretty much).
A -i parameter, as in rm -i filename, provides for a verification prompt before deleting multiple files. Type "n" or "y" in response.
% lsMany users set an alias for rm to rm -i for safety. See Customizing Your Environment for more information on customizing your environment. Additionally, the noclobber variable can help to protect your files from accidential deletions (See C Shell Variables and Things to Avoid).
foo bar
% rm -i *
rm: remove foo? y
rm: remove bar? n
% ls
bar
The cp command is used to create a duplicate copy of an existing file. The form of the cp command is:
% cp oldFile newFile
UNIX makes a copy of oldFile and calls it newFile. If newFile already exists, it is overwritten. Again, UNIX does not verify the copy by default. See Figure 3.4 for an example of the cp command. You can, however, use the -i option to avoid accidentally destroying files.
The mv command is used to move or rename a file. The form of the mv command is:
% mv oldname newname
UNIX renames oldname to newname, effectively moving it from one file to another. If new_name already exists, it is overwritten. UNIX does not verify that it has moved the file. As with the rm and cp commands, you can use the -i option. See Figure 3.4 for an example of the mv command.
% ls dog.dat hello.dvi hello.tex sub2 hello.aux hello.log oscar verona.txt % cp oscar zzz.dat % ls dog.dat hello.log oscar verona.txt hello.aux hello.tex sub2 zzz.dat hello.dvi % mv sub2 view.sub % ls dog.dat hello.log oscar view.sub hello.aux hello.tex verona.txt zzz.datNote: Both cp and mv allow you to overwrite existing files. To overwrite means that the contents of the previous existing file are gone forever. It is very easy to overwrite an existing file if you are not being careful. Both commands have a -i option that will "inquire" whether you are sure you want to overwrite a file.
The ln command is used to create a link (like alias) of a file. The form of the ln command is:
% ln -s thisFile aliasFileNote: when you remove the alias, the old file(directory) is intact.
To see if a file is an alias, use this command:ls -d aliasDir
grep -i root /etc/passwd
grep -i r[o*]t /etc/passwd
grep -i [1-9] /etc/group
find . -type f -exec grep -i ldap {} /dev/null \;
`
find . -name my_file /home/mine
Note: there are many options availalbe under tar, enter tar --help will show you the usage of tar command. In the above examples:
c: create
f: file - a file name is required. The file name can be a device (/dev/fd0 which is floppy drive.
v: verbose - shows what files are processed
x: extract
z: compress file
j: bzip-compress file
. stands for all the files in the current directory
cd /tmp; gunzip mine.tgz
cd /tmp; zcat mine.tgz | tar tvf - (which is equivalent to tar tvfz /tmp/mine.tgz
cd /home/mine; tar xvfj /tmp/mine.tar.bz2
cd /tmp; bzcat mine.tar.bz2 | tar tvf - (which is equivalent to tar tvfj /tmp/mine.tar.bz2)Many freeware are released in tar format with tgz or bz2 compression. Typically you need to run either tar xfz fileName.tgz or tar xfj fileName.tar.bz2 to extract all the files into curretn directory. A good freeware will have README/Install text file to show how to install the software. If is a source code tree, normally it will come with a configuration command named: .configure which is used to generate makefiles. A makefile is used for making the executables and install software. These can be accomplished by:
./configure make (This reads a file namad Makefile or makefile from current directory) make install make -n install (This will not install SW, it is handy for troubleshoot)
mke2fs /dev/fd0H1440
mount /dev/fd0 /mnt
mount /dev/cdrom /cdrom
mount -t vfat /dev/hda1 /c
init 6
init 0
The above commands will reboot or halt the system respectively.
a: append
.: ending the insertion
w: write
q: quit
p: print (e.g.: 5p will show 5 lines of text)
+: go to the next line (e.g.: +5 will move down 5 lines down
-: go to the previous line (e.g.: +5 will move up 5 lines down
s: substitution (e.g.: 1,$s/ABC/xyz/)