login: myname password:(not echoed)In Unix, once you have logged on you will be running a program called a "shell". The shell is your interface to the operating system. A shell prints a prompt (below, the prompt is "%") when it is ready for a command. All commands are terminated by a carriage return. More about the shell later.
% yppasswd
yppasswd will prompt you for your old password, and then ask you to
enter your new one twice (to forestall mistakes). For your own
security, you should try and choose a password that is not easily
guessable. Here's some helpful guidelines:% cd /bin % cd /usr/include % cdThe first example moves you to the system binaries directory. The third example moves you to your home directory, where you can store your own files.
% cd sys % cd ..In the first example, we moved into the sys subdirectory of the current directory. In the second example, we moved to the "parent" directory (the directory that your current directory is a subdirectory of).
% cd /var/spool % cd .. % pwd /var
% cd /var/spool % ls calendar lpd mqueue secretmail cron lpd.lock printers uucp locks mail rwho uucppublicTo display more information about the files in the directory, type "ls -l" instead:
% ls -l total 31 drwxrwsrwt 2 daemon 6656 Sep 2 04:04 calendar drwxr-sr-x 4 root 512 Aug 16 10:00 cron drwxr-sr-x 2 uucp 512 Jul 26 12:13 locks drwxrwsr-x 2 daemon 512 Jul 26 1995 lpd -rw-r--r-- 1 root 4 Aug 16 10:00 lpd.lock drwxrwsrwt 2 root 4608 Sep 2 16:39 mail drwxr-s--- 2 root 9728 Sep 2 16:39 mqueue lrwxrwxrwx 1 root 22 Jul 26 1995 printers -> /export/spool/printers drwxr-sr-x 2 root 512 Oct 14 1994 rwho drwxrwsrwx 2 bin 512 Oct 14 1994 secretmail drwxr-sr-x 10 uucp 512 Aug 16 10:00 uucp drwxrwsrwt 2 uucp 512 Oct 14 1994 uucppublic
% cd % mkdir games
% cd $HOME/games % rm * % cd .. % rmdir gamesNote that if you are using the (t)csh shell, the tilde character ~ is a shortcut for $HOME, your home directory. Hence the following are equivalent:
% cd % cd ~/ % cd $HOMESimilarly the following are equivalent:
% cd ~/bin % cd $HOME/bin
cp source_file destinationSome examples:
% cp /etc/holidays myfile % cp myfile myfile-oldThe first example copies the file holidays in the directory /etc into the file myfile in the current directory.
mv source destinationYou can use this to move a file, or to rename it:
% mv myfile-old myfile.old % mv myfile.old backups/myfile.oldThe first example renames myfile-old so it is now named myfile.old. The second example moves myfile.old into the backups/ directory.
rm file_to_be_removedUse this command to delete files you don't want:
% rm random.file
% cat myfile (displays contents of myfile)
% more myfile"More" allows you to read a file page by page. While viewing the file, the basic commands are space to see the next page, q to quit, return to see one more line, and b to go back a page.
% cp /bin/ls myls % mylsSometimes you may run into a program that will not quit, or is stuck in an endless loop, and is tying up the shell. To abort the program, just type Ctrl-C while in the shell that is executing the program. This should cause the program to terminate.
If for some reason when trying to run some program you get:
% programbin programbin: Permission denied.you can correct the problem by changing the file permissions to execute:
% chmod u+x programbin
man command man -k keyword apropos keywordman gives you information about specific commands. man -k tells you what commands relate to a given keyword.
% man -k sqrt cbrt sqrt (3m) - square root, cube root sqrt sqrt (3m) - square root, cube root sqrt cplxexp (3) - functions in the C++ complex number math libraryThe number in parentheses refers to the chapter of the manual in which the command is listed.
% man BattleTrisIf you are working on a X-Windows environment (ie. you are logged on from a workstation or an X-terminal, you can also try xman for a graphical interface to the man pages:
% xman &The "&" at the end of the previous line is used to run the "xman" process in the background and give you back control over your shell.