You are on page 1of 31

Misc commands

man,banner,cal, calendar,clear,nohup, tty .

Man ual command.
man man This is help command, and will explains you about online manual pages you can also use man in conjunction with any command to learn more about that command for example.
y y

man ls will explain about the ls command and how you can use it. man -k pattern command will search for the pattern in given command.

Banner command.
banner prints characters in a sort of ascii art poster, for example to print wait in big letters. I will type banner wait at Unix command line or in my script. This is how it will look.
# # # # # # # ## # ## ## # # ## # # # # ###### # # # # # # # # # # ##### # # # # #

Cal command
cal command will print the calendar on current month by default. If you want to print calander of august of 1965. That's eighth month of 1965. cal 8 1965 will print following results.
August 1965 S M Tu W Th F S 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31

Clear command
clear command clears the screen and puts cursor at beginning of first line.

Calendar command
calendar command reads your calendar file and displays only lines with current day. For example in your calendar file if you have this
12/20 1/15 1/20 Test new software. Test newly developed 3270 product. Install memory on HP 9000 machine.

On dec 20th the first line will be displayed. you can use this command with your crontab file or in your login files.

Nohup command.
nohup command if added in front of any command will continue running the command or process even if you shut down your terminal or close your session to machine. For exmaple, if I want to run a job that takes lot of time and must be run from terminal and is called update_entries_tonight . nohup update_entries_tonight will run the job even if terminal is shut down in middle of this job.

Tty command
Tty command will display your terminal. Syntax is tty options Options
y y

-l will print the synchronous line number. -s will return only the codes: 0 (a terminal), 1 (not a terminal), 2 (invalid options) (good for scripts)

back to top of misc commands back to top of page

File Management commands.
cat,cd, cp, file,head,tail, ln,ls,mkdir ,more,mv, pwd, rcp,rm, rmdir, wc.

Pwd command.
pwd command will print your home directory on screen, pwd means print working directory.
/u0/ssb/sandeep

is output for the command when I use pwd in /u0/ssb/sandeep directory.

Ls command
ls command is most widely used command and it displays the contents of directory.

options
y y y y y y y

ls will list all the files in your home directory, this command has many options. ls -l will list all the file names, permissions, group, etc in long format. ls -a will list all the files including hidden files that start with . . ls -lt will list all files names based on the time of creation, newer files bring first. ls -Fxwill list files and directory names will be followed by slash. ls -Rwill lists all the files and files in the all the directories, recursively. ls -R | more will list all the files and files in all the directories, one page at a time.

Mkdir command.
mkdir sandeep will create new directory, i.e. here sandeep directory is created.

Cd command.
cd sandeep will change directory from current directory to sandeep directory. Use pwd to check your current directory and ls to see if sandeep directory is there or not. You can then use cd sandeep to change the directory to this new directory.

Cat command cat cal.txt cat command displays the contents of a file here cal.txt on screen (or standard out).

Head command.
head filename by default will display the first 10 lines of a file. If you want first 50 lines you can use head -50 filename or for 37 lines head -37 filename and so forth.

More command.Tail command. wc -c filename will print total number of characters in a file. For example if you have a file which is 500 lines and you want to read it all. If you want last 50 lines then you can use tail -50 filename. tail filename by default will display the last 10 lines of a file. File command displays about the contents of a given file. I will get file resume. cp command copies a file. whether it is a text (Ascii) or binary file. To use it type file filename.txt cal. File command. If I want to copy a file named oldfile in a current directory to a file named newfile in a current directory. words or lines in a file depending upon the option. So you can use more filename Wc command wc command counts the characters.doc: data ascii text file cal.doc file which is a binariy file in microsoft word.doc resume1.txt: Cp command. cp oldfile newfile If I want to copy oldfile to other directory for example /tmp then cp oldfile /tmp/newfile. Useful options available with cp are -p and -r .txt which has ascii characters about calander of current month and I have resume1. -p options preserves the . For example I have cal. Options y y y wc -l filename will print total number of lines in a file. more command will display a page at a time and then wait for input which is spacebar. wc -w filename will print total number of words in a file.

-r recursively copy a directory and its files.modification time and permissions. mv command is used to move a file from one directory to another directory or to rename a file. Instead of copying you can also make links to existing files using ln command. mv * /usr/bajwa/ will move all the files in current directory to /usr/bajwa directory. Rcp command. mv -i oldfile newfile for confirmation prompt. . For example you are on a unix system that is called Cheetah and want to copy a file which is in current directory to a system that is called lion in /usr/john/ directory then you can use rcp command rcp filename lion:/usr/john You will also need permissions between the two machines. ln -n option will not overwrite existing files. If you want to create a link to a file called coolfile in /usr/local/bin directory then you can enter this command. Ln command. duplicating the tree structure. mv -f oldfile newfile will force the rename even if target file exists. Some examples: y y y y mv oldfile newfile will rename oldfile to newfile. ln mycoolfile /usr/local/bin/coolfile Some examples: y y y ln -s fileone filetwo will create a symbolic link and can exist across machines. For more infor type man rcp at command line. Mv command. rcp command will copy files between two unix systems and works just like cp command (-p and -i options too). ln -f will force the link to occur.

Rm command. Options: y y y y rm -r directory_name will remove all files even if directory is not empty. diff command will compare the two files and print out the differences between. fileone and file two. rmdir command will remove directory or directories if a directory is empty. rmdir sandeep is how you use it to remove sandeep directory. cmp. Diff command. rm -f option will remove write-protected files without prompting. back to top of File management commands back to top of page Comparison and Searching diff. rmdir -s will suppress standard error messages caused by -p.dircmp. find. grep. Contents of fileone are This this this this this is is is is is first file second line third line different as. To delete files use rm command. rmdir -p will remove directories and any parent directories that are empty. Rmdir command. rm -r option will delete the entire directory as well as all the subdirectories.lkdjf not different . Options: y y y rm oldfile will delete file named oldfile. very dangerous command. Here I have two ascii text files.

txt .lkdjf xxxxxxxas.txt . 1 if files are different.txt .txt . dircmp command compares two directories. cmp command compares the two files. 2 if files are inaccessible./fourth./junk. cmp fileone filetwo will give me fileone filetwo differ: char 80./third.txt . -s command can be used to return exit codes. return 0 if files are identical.txt Grep Command grep command is the most useful search command./dohazaar. i. line 4 if I run cmp command on similar files nothing is returned. no changes Dircmp Command. It can be used to search one or more files to match an . You can use it to find processes running on system./rmt. For exmaple I have two different files fileone and filetwo.txt . etc.txt ./four./cal.e./test. Then dircmp dirone dirtwo will return this Dec 9 16:06 1997 dirone only and dirtwo only Page 1 .lkdjf Cmp command.txt . This following command prints a message 'no changes' if files are same cmp -s fileone file1 && echo 'no changes' .filetwo contains This this this this this is is is is is first file second line third line different xxxxxxxas.lkdjf not different diff fileone filetwo will give following output 4c4 < this is different --> this is different as. If i have two directories in my home directory named dirone and dirtwo and each has 5-10 files in it./te. to find a pattern in a file.

ps -ef | grep sleep will display all the sleep processes running in the system as follows. other associated commands with grep are egrep and fgrep. will remove all empty files on system. group or all. -l lists filenames but not matched lines. .expression. Some Examples: find $HOME -print will lists all files in your home directory. find / -size 0 -ok rm {} \. -c option will only print the count of matched lines.your. you can search for any file anywhere using this command provided that file and directory you are searching has read write attributes set to you . egrep typically runs faster. -ctime +n or -n will find that were changed +n -n or n days ago. Find descends directory tree beginning at each pathname and finds the files that meet the specified conditions. here it means search all processes in system and find the pattern sleep. Find command is a extremely useful command. -i ignores uppercase and lowercase distinctions. find /work -name chapter1 -print will list all files named chapter1 in /work directory. ops dxi ops ops ops dxi ops dxi ops ops ssb pjk 12964 12974 12941 12847 12894 13067 13046 12956 12965 12989 13069 27049 25853 15640 25688 25812 25834 27253 25761 13078 25737 25778 26758 3353 0 0 0 0 0 2 0 0 0 0 2 0 16:12:24 16:12:25 16:12:21 16:11:59 16:12:12 16:12:48 16:12:44 16:12:23 16:12:24 16:12:28 16:12:49 15:20:23 ttyAE/AAES ttyAH/AAHP ttyAE/AAEt ttyAH/AAH6 ttyAE/AAEX ttyAE/ABEY ttyAE/AAE0 ttyAG/AAG+ ttyAE/AAEp ttyAH/AAHv ttyAH/AAHs ? 0:00 0:00 0:00 0:00 0:00 0:00 0:00 0:00 0:00 0:00 0:00 0:00 sleep 60 sleep 60 sleep 60 sleep 60 sleep 60 sleep 1 sleep 60 sleep 60 sleep 60 sleep 60 grep sleep sleep 3600 Options: y y y y -b option will precede each line with its block number. for more information type man egrep or man fgrep in your system. conditions of find y y -atime +n |-n| n will find files that were last accessed more than n or less than -n days or n days. Here are some examples. find / -type d -name 'man*' -print will list all manpage directories. output of ps command is passed to grep command. Find command. It can also be used in conjunction with other commands as in this following example.

run the Unix command on each file matched by find.paste. l symbolic link. or f plain file.vi. C could be b or block. back to top of misc commands back to top of page Text processing cut. -type c Find file whole type is c. You can use it with cpio command.4 testfile will print this to standard output (screen) ts ts ts It is printing columns 1 and 4 of this file which contains t and s (part of this). Cut command. Options: y y y -c list cut the column positions identified in list. Option -c is for columns and -f for fields. c Character special file. -size n find files that contain n blocks. -print print or list to standard output (screen). -f list will cut the fields identified in list. working on actual files first and then directories.awk. It is entered as cut options [files] for example if a file named testfile contains this is firstline this is secondline this is thirdline Examples: cut -c1.sed. -exec commad {} \. cut command selects a list of columns or fields from one or more files. . Very useful condition. d directory. p fifo or named pipe. sort. -s could be used with -f to suppress lines without delimiters. uniq. -name pattern find the pattern. -perm nnnfind files whole permission flags match octal number nnn.y y y y y y y -depth descend the directory structure.

Sort command.will list users in two columns. for example if you have a file named testfile with these contents zzz aaa 1234 yuer wer qww wwe Then running sort testfile will give us output of 1234 aaa qww wer wwe yuer zzz Options: y y y y y -b ignores leading spaces and tabs.Paste Command. -i ignores non-printing characters. Options: y y -d'char' separate columns with char instead of a tab. in alphabetical order.. . who | paste . for example if a file named testfile contains this is firstline and a file named testfile2 contains this is testfile2 then running this command paste testfile testfile2 > outputfile will put this into outputfile this is firstline this is testfile2 it contains contents of both files in columns. -s merge subsequent lines from one file. -c checks whether files are already sorted. -n sorts in arithmetic order. -d ignores punctuation. sort command sort the lines of a file or files. paste command merge the lines of one or more files into vertical columns separated by a tab.

Here the output of command df -t is being passed into awk which is counting the field 1 after pattern "total" appears. Same way if you change $1 to $4 it will accumulate and display the addition of field 4 which is used space. but no unique lines. -u print only unique lines. -u identical lines in input file apear only one time in output. -d print duplicate lines once. Examples: df -t | awk 'BEGIN {tot=0} $2 == "total" {tot=tot+$1} END {print (tot*512)/1000000}' Will give total space in your system in megabytes. It works as sed [options] files options: . Examples sort names | uniq -d will show which lines appear more than once in names file. you can enter your sed commands in a file and then using -f option edit your text file. Options: y y y -c print each line once. counting instances of each. Here are some examples which are connected with other commands. uniq command removes duplicate adjacent lines from sorted file while sending one copy of each second file. awk is more like a scripting language builtin on all unix systems. sed command launches a stream line editor which you can use at command line. etc. Awk and Nawk command.y y y y -ofile put output in a file. +m[-m] skips n fields before sorting. -r reverse the order of sort. Although mostly used for text processing. Uniq command. and sort upto field position m. Sed command. for more information about awk and nawk command in your system enter man awk or man nawk.

o 1G to go to the first line in file. o nyy copy n number of lines to buffer. /string to search string in file. . o I inserts text at the curson o A appends text at the end of the line. for more information about sed. o $ to move to the end of line. o w to move forward to next word. o :%s/stringA/stringb /g to replace stringA with stringB in whole file. -f script Apply the set of instructions from the editing script.y y y -e 'instruction' Apply the editing instruction to the files. o d$ to delete from cursor to end of line. enter man sed at command line in your system. o P to paste text from buffer. o b to move backwards to next word. o yy to copy a line to buffer. vt100 emulation works good if you are logged in using pc. o dd to delete an entire line o ndd to delete n number of lines. Vi editor. In order to write characters you will need to hit i to be in insert mode and then start typing. o x to delete a single character. o <escape> to invoke command mode from insert mode. o J join a line with the one below it. vi command launches a vi sual editor. : for command mode. o a appends text after cursor. o :!sh to run unix commands. It has several modes. options: y y y y i for insert mode. o o open a new line of text below the curson. o G to go to last line in file. Make sure that your terminal has correct settings. Once you are done typing then to be in command mode where you can write/search/ you need to hit :w filename to write and in case you are done writing and want to exit :w! will write and exit. -n suppress default output. n to search for next occurence of string. To edit a file type vi filename vi editor is a default editor of all Unix systems. o O open a new line of text above the curson.

Other common features o o o o o o > will redirect output from standard out (screen) to file or printer or whatever you like.e. then entering bg at command line will put this job in background.cc compiler. will separate commands on same line. . echo.back to top of Text processing commands back to top of page Shell and programming Shell programming. >> filename will append at the end of a file called filename. entering fg will put this job in foreground. i. Shell programming is integral part of Unix operating systems. etc. these are called shells(interface).Z files and output is directed to a file named compressedfiles. User have an option of picking an interface on Unix such as ksh. good for joining commands. like ksh and csh are popular shells on unix although there are 5 or 6 different shells available but I will only be discussing ksh and csh as well as sh. Unix was written in C language and thus c language is integral part of unix and available on all versions. Common features among all shells are job control. or redirect output. or default sh. test. Shell programming is used to automate many tasks. Shell programming is not a programming language in the truest sense of word since it is not compiled but rather an interpreted language.sleep. Shell is command line userinterface to Unix operating system. . for example if I am running a processes which is searching the whole system for . < will redirect input to a process or commnand. csh. & at the end of command will run command in background.. Entering jobs at command line will show me all my concurrent jobs that are running.line. | pipe output. example: y y y y y find / -name *.bourne shell. csh. ksh. find command with cpio. Shell programming concepts and commands. Shells.Z -print > compressedfiles then after entering this command hitting <control z> key will suspend this job.

break break from loop statements. Bourne Shell (sh shell). if condition1 then commands1 elif condition2 then commands2 . i..e. else commands3 fi Ksh shell (Korn). sort file | lp will first sort a file and then print it. continue Resume a program loop..o o o o o o o o o o o o o o o * will match any characters in a file or directories. function name {commands..who. " " partial quote for variables. for x[in list] do commands done is syntax for for do loop. ` ` to run a command inside another command and use its output. # begin comment (if #/bin/ksh or csh or sh is entered at first line of script it runs script in that shell) bg background execution. . o alias ll="ls -la" will execute `ls -la` command whenever ll is entered. sh or Bourne shell is default shell of Unix operating systems and is the most simplest shell in Unix systems. Ksh or Korn shell is widely used shell. Kill pid number will terminate running jobs stop will stop background job. suspend will suspend foreground job.pwd)> logifile will redirect all the output from three commands to a filenamed logfile. alias [options] [name[='command']] will let you create your own commands.. (date. o let i=i+1 will work as a counter with i incrementing each time this statement is encountered. ls execute one after another.} is the syntax of a function which can be called from anywhere in program. () execute in subshell. wait will wait for a background job to finish. let expressions is syntax of let statement. ' ' full quote for variables. Examples: y y y y y y y y cd. . junk* will match all files with first 4 letters ? will match single characters in a file. .. [] will match any characters enclosed..

ftp. back to top of Shell programming. Sleep command. Line command.login. vacation and write . sleep command in shell programming. line command in shell programming. Echo command echo command in shell programming. Test Command. rlogin.Csh or C shell csh is second most used shell. . most Unix operating systems come with c compiler called cc.talk.telnet. CC compiler (c programming language compiler). Since Unix is itself written in C programming language. back to top of page Communications cu. test command in shell programming.

funet. cu command is used for communications over a modem or direct line with another Unix system.9600. System prompts you to enter userid and password. Ftp command (protocol). login command invokes a login session to a Unix system. -i turn off interactive prompts.g 1200. bin at ftp> prompt will set the transfer to binary. ftp command is used to execute ftp protocol using which files are transferred over two systems. Syntax is ftp options hostname options y y y y -d enable debugging. etc) -n prompts for a telephone number. Two types of files can be transferred.Cu command. -e sends even parity data to remote system -lline communicate on this device (line=/dev/tty001. you must have a login id to be able to transfer the files. aadr is an address specific to LAN. ASCII or Binary. -cname Search UUCP's device file and select local area network that matches name. . -sn set transmission rate to n(e. show all responses from remote server. -v verbose on. Practice FTP by ftping to nic.2400. -d Prints diagnostics. ftp hostname by default will connect you to the system. system is call the system known to uucp. BPS) Destination y y y telno is the telephone number of the modem to connect to. Syntax is cu options destination Options y y y y y y y -bn process lines using n-bit characters (7 or 8). Login command. -g disable filename globbing. which then authenticates the login to a system.fi loggin in as anomymous with password being your e-mail address.

Syntax is telnet hostname Vacation command. It returns a mail message to sender announcing that you are on vacation. to disable this feature. Talk command. instead of same as local host. type mail -F " " . rlogin command is used to log on to remote Unix systems. Telnet command invokes a telnet protocol which lets you log on to different unix. or an id defined in . Syntax is rlogin options host options y y y -8 will allow 8 bit data to pass. -l logfile will record in the logfile the names of senders who received automatic reply. vms or any machine connected over TCP/IP protocol. . -F user will forward mail to user when unable to send mail to mailfile. syntax is vacation options Options y y y y -d will append the date to the logfile. IPx protocol or otherwise. Syntax is talk userid@hostname Telnet command. instead of 7-bit data.rhosts file. -m mailfile will save received messages in mailfile. -e c will let you use escape character c. -l user will let you to login as user to remote host. vacation command is used when you are out of office. user must have permissions on both systems as well as same userid.Rlogin command. talk command is used to invoke talk program available on all unix system which lets two users exchange information back and forth in real time.

do not prompt before overwriting files. syntax is uncompress filename. -v Print the resulting percentage of reduction for files. mt. to uncompress this filename. syntax for compress command is compress options files Options y y y y -bn limit the number of bits in coding to n.Write command will initiate an interactive conversation with user. Its syntax is cpio flags [options] . Uncompress command. cpio. tar. -f compress conditionally.dump.Z file use uncompress filename command. Syntax is write user tty back to top of communications commands back to top of page Storage commands compress uncompress. Options y -c write to standard output without changing files Cpio command. or to another location on the local machine.Z this uncompresses the compressed file to its original name.pack.z extension. cpio command is useful to backup the file systems. Compress command. -c write to standard output (do not change files). Compress command compresses a file and returns the original file with . Uncompress file uncompresses a file and return it to its original form. It copy file archives in from or out to tape or disk.

-V print a dot for each file read or written. -o. . -v print a list of filenames. cpio -o o Copy out a list of files whose name are given on standard output. -b swap bytes and half-words. Options o o o o o o o o o o o o o o -a reset access times of input files. o Dump command is useful to backup the file systems. dump command copies all the files in filesystem that have been changed after a certain date. -R ID reassign file ownership and group information to the user's login ID. -d create directories as needed. It is good for incremental backups. This information about date is derived from /var/adm/dumpdates and /etc/fstab . -A append files to an archive (must use with -o).old files to a tape in /dev/rst8 o cpio -icdv "save"" < /dev/rst8 will restore all files whose name contain "save" o find . -c Read or write header information as Ascii character.old" -print | cpio -ocvB > /dev/rst8 will backup all *. -l link files instead of copying. -o file direct output to a file. -s swap bytes. -r rename files interactively. -S swap half bytes. Words are 4 bytes. -p y cpio -i [options] [patterns] o cpio -i copy in files who names match selected patterns. cpio -p o copy files to another directory on the same system. Examples find . -i. o If no pattern is used all files are copied in. o It is used to write to a tape. -B block input or output using 5120 bytes per record. -name "*. -depth -print | cpio -padm /mydir will move a directory tree.It has three flags.

Tar copies and restore files to a tape or any storage media.tar will creates an archive of current directory and store it in file backup. Tar command. tar command creates an archive of files into a single file.z . Pack command. -print' > backup.z To unpack a packed file use unpack command as unpack filename.'find . relative frequency and byte code.Print number of times each byte is used. f place the dump on next argument file instead of tape. Syntax is Pack options files Options y y y y .. To display Packed files in a file use pcat command pcat filename. . This example causes the entire file system (/mnt) to be dumped on /dev/rmt/c0t0d0BEST and specifies that the density of the tape is 6250 BPI. tar tvf /dev/rmt0 will list the tape's content in a /dev/rmt0 drive. tar cvf . d density of tape default value is 1600. Pcat and unpack will restore packed files to their original form. pack command compacts each file and combine them together into a filename.] filesystem] Options y y y y y y 0-9 This number is dump level.. and store on the tape in /dev/rmt0. o /usr/sbin/dump 0df 6250 /dev/rmt/c0t0d0BEST /mnt for more info type man dump at command line.syntax for HP-UX dump is /usr/sbin/dump [option [argument . Synopsis of tar is tar [options] [file] Examples: tar cvf /dev/rmt/0 /bin /usr/bin creates an archive of /bin and /usr/bin. -f Force the pack even when disk space isn't saved.z file. 0 option causes entire filesystem to be dumped. The original file is replaced.tar. b blocking factor taken into argument.

bsr Backward space count records. Examples o mt -t /dev/rmt/0mnb rew will rewind the tape in this device. r append files to a tape. x extract files from tape. bsf Backward space count files. offl Rewind tape and go offline. v print function letter (x for extraction or a for archive) and name of files. Mt command is BSD command and is seldom found in system V unix versions. smk Write count setmarks (DDS drives only). It give commands to tape device rather than tape itself. bss Backward space count setmarks (DDS drives only). o mt -t /dev/rmt/0mnb offl will eject the tape in this device. syntax is mt [-t tapename] command [count] mt for HP-UX accept following commands y y y y y y y y y y y y eof write count EOF marks. ejecting. fsf Forward space count files.Functions: y y y y c creates a new tape. Options: y y y y b n use blocking factor of n. etc. t print the names of files if they are stored on the tape. eod Seek to end of data (DDS and QIC drives only). fsr Forward space count records. l print error messages about links not found. rew Rewind tape. back to top of storage commands back to top of page . fss Forward space count setmarks (DDS drives only). Mt command Mt command is used for tape and other device functions like rewinding. L follow symbolic links.

write this file. -m will send mail to user after job is completed. env. Learn to read these permissions in binary. everyone else can read only. shutdwon.meaning respectively that owner can read and write file. At command. who." and I want to run this script at 8:00 AM.crontab.or user can read. -r jobnumber will remove specified jobs that were previously scheduled.stty. there are 135 bytes in this file. df. ps. group can read only.txt -rw-rw-rw1 ssb dxidev 135 Dec 3 16:14 cal. chown. So I will first type at 8:00 %lt. member of the owner's group can read and write this file and anyone else connected to this system can read and write this file. if permissions are 755 or 111 101 101 that means rwxr-xr-x or user can read. next ssb is owner of this file dxidev is the group of this file. write and execute.txt. finger. chmod.txt In this line above I have -rw-rw-rw. this file was created on December 3 at time16:14 and at the end there is name of this file. at command along with crontab command is used to schedule jobs. Similarly.System Status at.enter> usersloggedin %lt. -l will report all jobs that are scheduled and their jobnumbers. for example if I have a text file with calender in it called cal. As you can see this file has 666 or -rw-rw-rw attributes. Options: y y y y -f file will execute commands in a file. . initially when this file will be created the permissions for this file depends upon umask set in your profile files. Chmod command. ls -la cal.du.chgrp. like this for example Decimal 644 which is 110 100 100 in binary meand rw-r--r-. #!/bin/ksh who | wc -l echo "are total number of people logged in at this time. for example if I have a script named usersloggedin which contains.enter> I will get following output at 8:00 AM 30 are total number of people logged in at this time.ruptime. group can read and execute.. chmod command is used to change permissions on a file.date. at options time [ddate] [+increment] is syntax of at command.

You must have permission to run this command by unix Administrator.e. chgrp [options] newgroup files is syntax of chgrp. Minutes 0-59 Hour Day of month month Day of week 0-23 1-31 1-12 0-6 (0 is sunday) so for example you want to schedule a job which runs from script named backup_jobs in /usr/local/bin directory on sunday (day 0) at 11.25 (22:25) on 15th of month. -R recursively descend through directory changing group of all files and subdirectories. crontab command is used to schedule jobs. Jobs are scheduled in five numbers. Newgroup is either a group Id or a group name located in /etc/group . 25 22 15 * 0 /usr/local/bin/backup_jobs . including subdirectories and symbolic links. Chgrp command. -R will recursively descend through the directory. chmod 600 filename. as follows. The entry in crontab file will be.everyone else can read and execute. Crontab command. Chown command. So if you don't want anyone to see your files or to do anything with it use chmod command and make permissions so that only you can read and write to that file. All directories have d in front of permissions. chgrp command is used to change the group of a file or directory. chown command to change ownership of a file or directory to one or more users. Syntax is chown options newowner files Options y y -h will change the owner on symbolic links. Options: y y -h will change the group on symbolic links. * represents all values. i. You must own the file or be a superuser.

Date command. syntax is df options name Options y y y y y y y -b will print only the number of free blocks. Df command. Finger command. -e will print only the number of free files.The * here tells system to run this each month. Sun Dec 7 14:23:08 EST 1997 is similar to what you should see on screen.This will scheduled the jobs. Date displays todays date. -k will print allocation in kilobytes. It reports the number of free disk blocks. -f will report free blocks but not free inodes. du command displays disk usage. to use it type date at prompt. Syntax is crontab file So a create a file with the scheduled jobs as above and then type crontab filename . Typically a Disk block is 512 bytes (or 1/2 Kilobyte). -n will print only the file system name type. env command displays all the variables. df command displays information about mounted filesystems. -F type will report on an umounted file system specified by type. Env command. finger command. with no arguments it lists type of all filesystems Du command. -l will report only on local file systems. .

options. Ruptime command. -t sort by uptime. o 5 stop system. go to firmware mode. .PS command ps command is probably the most useful command for systems administrators. -f Lists a full listing. y y y y y -a include user even if they've been idle for more than one hour. -l sort by load average. o s single-user state (default) o 0 shutdown for power-off. Shutdown command. -j print process group ID and session ID. To gracefully bring down a system. -y suppress the default prompt for confirmation. o 6 stop system then reboot. Shutdown command can only be executed by root. y y y -gn use a grace-period of n seconds (default is 60). -ik tell the init command to place system in a state k. but mount multi-user file systems. It reports information on active processes. -i sort by number of users. ps options options. y y y y -a Lists all processes in system except processes not attached to terminals. ruptime options options. -e Lists all processes in system. o 1 like s. -r reverse the sort order. ruptime command tells the status of local networked machines. shutdown command is used.

without options stty reports terminal settings. -b Report information about last reboot.txt To create a new file called cal. etc here. -d report expired processes. . will change your keyname to be backspace key. who options file Who as default prints login names of users currently logged in. -g report current settings. cal > cal. -H print headings. -p report previously spawned processes. Advance unix command concepts Put advance commands utilities.txt that has calendar for current month. > sign redirects output from stdout (screen) to a file.Stty command stty command sets terminal input output options for the current terminal. n set terminal baud. stty options modes < device options y y -a report all options. Options y y y y y y -a use all options. Who command who command displays information about the current status of system. Modes y y y 0 hang up phone. erase keyname. redirection. -u report terminal usage.

They are probably similar to commands you already know for another operating system.html more index. cd 3.bak rm *. 9. mkdir rmdir cp 6. these will be quite valuable in managing your own account.html man ls Description Lists files in current directory List in long format Change directory to tempdir Move back one directory Move into dhyatt's web-docs directory Make a directory called graphics Remove directory (must be empty) Copy file into directory Make backup of file1 Remove or delete file Remove all file Move or rename files Look at file.bak rm file1.Ten ESSENTIAL UNIX Commands These are ten commands that you really need to know in order to get started with UNIX.tmp mv old. Command Example Description . rm 7. 5. one page at a time Send file to printer Online manual (help) about command 2. 4. mv more lpr 10. cd ~dhyatt/web-docs mkdir graphics rmdir emptydir cp file1 web-docs cp file1 file1. 8.html new. ls Example ls ls -alF cd tempdir cd . man Ten VALUABLE UNIX Commands Once you have mastered the basic UNIX commands. Command 1.html lpr index..

tjhsst.edu 8.c -o file g++ fil2. kill <opt> <ID> kill -9 8453 gcc file. grep <str><files> 2.html chmod 755 file.edu ftp station1. telnet <host> ssh <host> Open a connection to vortex Open a secure connection to jazz as user dhyatt Upload or Download files to station1 Connect to archives at UNC 10. mail (pine) 9.tjhsst.gz mail me@tjhsst. chmod <opt> <file> grep "bad word" * Find which files contain a certain word Change file permissions read only Change file permissions to executable Change passwd List all running processes by #ID List process #ID's running by dhyatt Kill process with ID #8453 Compile a program written in C Compile a program written in C++ Compress file Uncompress file Send file1 by email to someone Read mail using pine chmod 644 *.cpp -o fil2 6. 4. and should not be considered idle entertainment.edu ncftp metalab. gcc (g++) <source> 7.1. .edu < file1 pine telnet vortex.exe 3. ftp <host> ncftp <host/directory> Ten FUN UNIX Commands These are ten commands that you might find interesting or amusing.tjhsst.edu ssh -l dhyatt jazz. gzip <file> gzip bigfile gunzip bigfile.unc. They are actually quite helpful at times. passwd ps <opt> passwd ps aux ps aux | grep dhyatt 5.

Command 1. 5. 3. cal <mo> <yr> 8. xeyes xcalc xeyes & xcalc & mpage -8 file1 | lpr Keep track of cursor (in "background") Calculator ("background" process) Print 8 pages on a single sheet and send to printer (the font will be small!) 10. 6. ytalk <user@place> 4. 9. who finger Example who finger ytalk dhyatt@threat history fortune date cal 9 2000 Description Lists who is logged on your machine Lists who is on computers in the lab Talk online with dhyatt who is on threat 3. 2. mpage <opt> <file> Ten HELPFUL UNIX Commands These ten commands are very helpful. netscape xv xfig / xpaint Example netscape & xv & xfig & (xpaint &) Description Run Netscape browser Run graphics file converter Run drawing program . 2. especially with graphics and word processing type applications.Command 1. history fortune date Lists commands you've done recently Print random humerous message Print out current date Print calendar for September 2000 7.

2. xhost xhost + threat.tex Run photoshop type program Spell check file1 Run LaTeX. ) 10. mdel.edu xhost - . 5. alias alias lls="ls -alF" 4. a scientific document tool Different editors Run StarOffice. df du Example df du -b subdir Description See how much free disk space Estimate disk usage of directory in Bytes Create new command "lls" for long format of ls Permit window to display from xwindow program from threat Allow no x-window access from other systems 3. Command 1. m-tools (mdir. etc.tjhsst. mformat. a full word processor DOS commands from UNIX (dir A:) Copy file1 to A: 7. 6. xemacs / pico soffice xemacs (or pico) soffice & 9. mcopy. 8. gnuplot mdir a: mcopy file1 a: gnuplot Plot data graphically Ten USEFUL UNIX Commands: These ten commands are useful for monitoring system access. or simplifying your own environment. gimp ispell <fname> latex <fname> gimp & ispell file1 latex file.4.

tar gv filename. ghostview (gv) 8.edu traceroute www.tar of a directory Extract files from an archive file View a Postscript file 6. top Print system usage and top resource hogs How to quit a UNIX shell. 10.ps 7.5.yahoo.tjhsst. ping (traceroute) ping threat. fold fold -s file1 | lpr Fold or break long lines at 60 characters and send to printer Create an archive called subdir. tar tar -cf subdir. logout (exit) logout or exit .com top See if machine is alive Print data path to a machine 9.tar subdir tar -xvf subdir.