Why have bread when you can have a schadenfreude
Archive for the ‘Uncategorized’ Category
Why have bread when you can have a schadenfreude
November 1, 2009bank1
June 5, 2009Computer General Awareness : Bank PO‘s, Bank Clerk
1. Which of the following is a part of the Central Processing unit? a. Printer b. Key board c. Mouse d. Arithmetic & Logic unit e. None of these 2. CAD stands for a. Computer aided design b. Computer algorithm for design c. Computer application in design d. All of the above e. None of these 3. Which of the following printer cannot print graphics? a. Ink-jet b. Daisy Wheel c. Laser d. Dot-matrix e. None of these 4. A program written in machine language is called? a. Assembler b. Object c. Computer d. Machine e. None of these 5. The father of Modern Computer is a. Charles Babbage b. Von-nuumann c. Danies Ritchel d. Blaise Pascal e. None of these 6. The Word FTP stands for a. File Translate Protocol b. File Transit Protocol c. File Transfer protocol d. file typing protocol e. None of these 7. The lowest form of Computer language is called a. BASIC b. FORTRAN c. Machine Language d. COBOL e. None of these 8. Best Quality graphics is produced by a. Dot Matix b. Laser Printer c. Inkjet Printer d. Plotter e. None of these 9. Memory which forgets every thing when you switch off the power is known as a. Corrupted b. Volatile c. Non-Volatile d. Non-Corrupted e.None of these 10.The linking of computers with a communication system is called a. Networking b. Pairing c. Interlocking d. Assembling e. Sharing 11.The 16 bit Microprocessor means that it has a. 16 address lines b. 16 Buses c. 16 Data lines d. 16 routes e. None of these 12. Data going into the computer is called a. Output b. algorithm c. Input d. Calculations e. flow chart 13. Which of the following refers to a small, single-site network? a. LAN b. DSL c. RAM d. USB e. CPU 14. Microsoft Office is a. Shareware b.Public domain software c. Open-sourse software d. A vertical market application e. An application
15. How many options does a BINARY choice offer
a. None of these
b. One
c. Two
d. it depends on the amount of memory on the computer
e. It depends on the speed of the computer’s processor
16. A collection of program that controls how your computer system runs and processes information is called
a. Operating System
b. Computer
c. Office
d. Compiler
e. Interpreter
17. Computer connected to a LAN (Local Area Network) can
a. run faster
b. go on line
c. share information and /or share peripheral equipment
d. E-mail
e. None of these
18. Information travels between components on the mother board through
a. Flash memory
b. CMOS
c. Bays
d. Buses
e. Peripherals
19. How are data organized in a spreadsheet?
a. Lines & spaces
b. Layers & Planes
c. Height & Width
d. Rows & Columns
e. None
20. The blinking symbol on the computer screen is called the
a. mouse
b. logo
c. hand
d. palm
e. cursor
21. A fault in a computer program which prevents it from working correctly is known as
a. Boot
b. Bug
c. Biff
d. Strap
e. None of these
22. A self replicating program, similar to a virus which was taken from a 1970s science fiction novel by John Bruner entitled the Shockwave Rider is _________
a. Bug
b. Vice
c. Lice
d. Worm
e. None of these
23. A _______ is a bi-stable electronic circuit that has two stable states.
a. Multivibrator
b. Flip-flop
c. Logic gates
d. laten
e. None of these
24. Unwanted repetitious messages, such as unsolicited bulk e-mail is known as
a. Spam
b. Trash
c. Calibri
d. Courier
e. None of these
25.DOS stands for
a. Disk Operating System
b. Disk operating session
c. Digital Operating System
d. Digital Open system
e. None of these
26. Who is the chief of Miocrosoft
a. Babbage
b. Bill Gates
c. Bill Clinton
d. Bush
e. None of these
27. Which of the following are input devices.
a. Keyboard
b. Mouse
c. Card reader
d. Scanner
e. All of these
28. Examples of output devices are
a. Screen
b. Printer
c. Speaker
d. All of these
e. None of these
29. Which of the following is also known as brain of computer
a. Control unit
b. Central Processing unit
c. Arithmatic and language unit
d. Monitor
e. None of these
30. IBM stands for
a. Internal Business Management
b. International Business Management
c. International Business Machines
d. Internal Business Machines
e. None of these
31.___________ translates and executes program at run time line by line
a. Compiler
b. Interpreter
c. Linker
d. Loader
e. None of these
32. ___________ is an OOP principle
a. Structured programming
b. Procedural programming
c. Inheritance
d. Linking
e. None of these
33. COBOL is widely used in _________ applications
a. Commercial
b. Scientific
c. Space
d. Mathematical
e. None of these
34. RAM stands for
a. Random origin money
b. Random only memory
c. Read only memory
d. Random access memory
e. None of these
35. 1 Byte = ?
a. 8 bits
b. 4 bits
c. 2 bits
d. 9 bits
e. None of these
36. SMPS stands for
a. Switched mode Power Suply
b. Start mode power supply
c. Store mode power supply
d. Single mode power supply
e. None of these
37. The device used to carry digital data on analog lines is called as
a. Modem
b. Multiplexer
c. Modulator
d. Demodulator
e. None of these
38. VDU is also called
a. Screen
b. Monitor
c. Both 1 & 2
d. printer
e. None of these
39. BIOS stands for
a. Basic Input Output system
b. Binary Input output system
c. Basic Input Off system
d. all the above
e. None of these
40. Father of ‘C’ programming languagea. Dennis Ritchie
b. Prof Jhon Kemeny
c. Thomas Kurtz
d. Bill Gates
e. None of these
ANSWERS
1. (d) 2. (a) 3. (b) 4. (a) 5. (a)
6. (c) 7. (c) 8. (d) 9. (b) 10. (a)
11. (c) 12. (c) 13. (a) 14. (e) 15. (c)
16. (a) 17. (c) 18. (c) 19. (d) 20. (e)
21. (b) 22. (d) 23. (b) 24. (a) 25. (a)
26. (b) 27. (e) 28. (d) 29. (b) 30. (c)
31. (b) 32. (c) 33. (a) 34. (d) 35. (a)
36. (a) 37. (a) 38. (c) 39. (a) 40. (a)
SSC
June 4, 2009Functions of Staff Selection Commission
As per Govt. of India, Ministry of Personnel, Public Grievances and Pensions (Deptt. Of P & T) Resolution no. 39018/1/98-Esstt(B) dt. 21.5.1999 (Appendix II), the Staff Selection Commission now makes recruitment to Group B (Non-Gazetted) and non-technical group ‘C’ non-gazetted posts in the Ministries/ Departments, attached and subordinate offices of the Government of India; the C.A.G and its Accountant-General offices, Election Commission & Central Vigilance Commission. The Commission is responsible for formulation of policies regarding schemes of examination and other procedures for smooth conduct of examinations/selection tests, including various Departmental Examinations for
Promotion from Group ‘D’ to LDC Grade;
Promotion from LDC Grade to UDC Grade;
Promotion from Stenographer Grade ‘D’ to Stenographer Grade ‘C’.
Civil Services
June 4, 2009A country as vast and thickly populated as India needs a well organised government machinery for proper governance. There are two facets to the administration of a country. One is security for which the country has its defence services and the other is the non-military part, which is taken care of by the Civil Services.
The origin of the IAS can be traced back to the year of India’s independence, 1947. The IAS operates at three levels -central, district and divisional. Work at the central level involves the framing and implementation of policies. The functions of the IAS at the district level encompass all district affairs with special emphasis on development. General administration and development work is the responsibility of the IAS at the divisional level. The post of an IAS officer carries a lot of responsibility. The work definition of an IAS officer would encompass framing, modifying and interpreting policy matters in consultation with the concerned Minister. Implementation of policies calls for supervision and also travelling to the places where the decisions taken are being implemented. Implementation entails disbursement of funds, which calls for personal supervision. The officers are answerable to the Parliament for any irregularities that may occur. At the top of the hierarchy of IAS officers is the Cabinet Secretary followed by Secretary/ Additional Secretary, Joint Secretary, Director, Under Secretary and then the Junior Scale Officers. These posts are filled according to seniority.
The Indian Police Service (IPS) As the name suggests, the main responsibility of the IPS is public safety and security. The Indian Police Service is divided into various departments like the Crime Branch, the Criminal Investigation Department, Home Guards and the Traffic Bureau. The area of functioning for the IPS can be broadly divided into: maintenance of law and order, crime prevention and detection, traffic control and accident prevention and management. The IPS also has several policing agencies like the Intelligence Bureau, the Central Bureau of Investigation, Cabinet Secretariat Security, Border Security Force and the Central Reserve Police Force. After the initial probation of two years, an IPS officer is given charge as an Additional Superintendent of Police of a district. This post is usually held for two years and then comes the next appointment, that of the Superintendent of Police and then the post of the Deputy Inspector General (DIG). The hierarchy in the IPS cadre is like this – the Director General of Police (DG) is the head of the entire Police force of a state. Special divisions of the Police force like the Border Security Force, the CBI, etc., have a Director General at the helm.
The Indian Forest Service (IFS) The maintenance of the natural resources of the country is very essential for a balanced all round development of the country. Maintenance of forests is so important for maintaining the ecological balance that the Indian Forest Service has been set up for this very purpose. The All India Forest Service came into being in 1966. The areas of functioning for the Indian Forest Service include protection and conservation of forests, wildlife and forest produce.
Banking
June 4, 2009
Hi! Welcome to the Banking Exams preparation section. Here you can get all the banks clerical, Probationary Officers and Special Officer Exams Training materials and Practise papers. All the Best !!!!
1 2 3 4 5 6 7 8 9 10
Networking
May 30, 2009
December 21, 2008
Sending Messages and Files to Other Users
Electronic mail programs run on almost all the computers at Caltech and usually have two parts: a user interface which lets users read and send messages and a system mailer which talks to mailers on other computers. This mailer receives outgoing messages from the user interface programs and delivers incoming messages to the user mailbox (which the interface program reads).
/usr/ucb/mail
There are many user interfaces available on the UNIX computers, all of which provide similar functionality. The program supplied with most UNIX computers is /usr/ucb/mail (or mailx). To read messages type mailx, to send messages type:
% mailx address
For information about valid mail addresses, please see the Electronic Mail Guide.
You should next see a Subject: prompt. If you don’t see a prompt, don’t worry, just type in your one line subject anyway and press return. Most likely you will now see a CC: prompt. If you wish to send copies of your message to someone besides the recipient you would enter the address or addresses (separated by commas) and press return. Otherwise press return without entering an address.
You can now start typing your message (but you will be unable to correct errors on lines after you have pressed to move to the next line) or you may specify a file to include, with ~r filename. If instead you only wish to send a file you can use the command mailx usr < filename instead.
You may invoke a text editor like vi by typing ~v. If you wish regularly to use an editor other than vi you should see the information later in the section about environment variables.
There are many other commands you may enter at this point — see the Mail man page for all of them. When you are finished typing in your message (if you have used ~v to run a text editor, you should exit from it) either press -D or enter a period on a line by themselves.
Other Mail Programs
Pine is a full-screen interactive mailer that is very straightforward to use. It is currently installed on the IMSS UNIX Cluster Suns. If you have the command setup pine in your .cshrc then you should type pine. If the pine command fails you probably need to type setup pine first. For more information type man pine.
Other mailers include ELM and MH. Both require setup commands. The command to start ELM is elm. MH is actually a set of several separate programs. See man mh for more information. Documents about using Pine, ELM and MH are available from IMSS. To get a copy, send mail to help@caltech.edu.
Write
The write program can be used to send messages to other users logged onto the system. It’s not the best way of having a conversation, but it’s simple to use. Enter:
% write username
and you can start writing lines to the terminal of the person you want to send messages to. The person must be logged in, and, if they are logged in more than once, you must specify the terminal to write to; write melville ttyh1, for example.
Ytalk
ytalk is a program which allows two users to hold a conversation. Unlike write, it can be used between different computers; and, unlike write, it divides the screen so that the things you type appear in the top half and the things written to you appear in the bottom half.
To ytalk to users on the same computer:
% ytalk username
To ytalk to users on another computer use the address format of username@nodename:
% ytalk brunton@jarthur.claremont.edu
Addressing Remote Nodes
ytalk can only be used to other Internet nodes: usually computers which have ending names such as .edu, .com, .org, .gov, or .mil. Not all computers with these names are attached directly to the Internet. finger and ytalk won’t work with computers which are only attached by mail gateways.
December 21, 2008
The System and Dealing with Multiple Users
Most UNIX commands which return information about how much CPU time you’ve used and how long you’ve been logged in use the following meanings for the words “job” and “process.”
When you log in, you start an interactive “job” which lasts until you end it with the logout command. Using a shell like C shell which has “job control” you can actually start jobs in addition to your login job. But for the purposes of the most information returning programs, “job” refers to your login session.
Processes, on the other hand, are much shorter lived. Almost every time you type a command a new process is started. These processes stay “attached” to your terminal displaying output to the screen and, in some cases (interactive programs like text editors and mailers), accepting input from your keyboard.
Some processes last a very long time — for example, the /bin/csh (C-shell) process, which gets started when you log in, lasts until you log out.
Information About Your Processes
You can get information about your processes by typing the ps command.
PID TTY TIME CMD
835 pts/1 0:03 csh
The columns indicate terminal (TTY) on which the process is running, the process identification numbers (PID), and the amount of CPU time the process has accumulated (TIME).
Information About Other People’s Processes
who
The simplest and quickest information you can get about other people is a list of which users are logged in and at which “terminals” (terminal here is either a terminal device line or telnet or rlogin session). The command to do this is who and it responds quickest of all the commands discussed here because it simply examines a file which gets updated every time someone logs in or out.
Be careful though! This file, /etc/utmp, can get out of date if someone’s processes die unexpectedly on the system. Any program which uses utmp to report information might occasionally list users who are not really logged in!
% who
rem pts/0 Aug 16 14:40 (shada)
wjzhou pts/2 Aug 19 00:59 (relax.che.caltech.edu)
aji pts/13 Aug 23 18:22 (hq.rainfinity.com)
lara pts/1 Aug 23 12:51 (wolf.eql.caltech.edu)
avayona pts/3 Aug 22 21:49 (gondor.submm.caltech.edu)
kmu pts/5 Aug 19 18:37 (ken.gg.caltech.edu)
shachi pts/7 Aug 22 22:01 (braun-103.caltech.edu)
auddess pts/73 Aug 23 16:20 (charter-DHCP-59.caltech.edu)
htyu pts/6 Aug 18 19:36 (afar.carl.rhno.columbia.edu)
dswang pts/44 Aug 23 17:49 (kuppermac2.caltech.edu)
surpi pts/8 Aug 23 10:28 (garfield.tapir.caltech.edu)
justa pts/87 Aug 23 16:47 (30-233-44-208.user.darwin.net)
jasonmc pts/23 Aug 19 15:01 (fleming-154.caltech.edu)
mkallis pts/16 Aug 23 18:13 (avery-70.caltech.edu)
marat pts/28 Aug 20 18:20 (hpl3cit2.cern.ch)
tanja pts/20 Aug 21 19:00 (131.215.64.118)
vineet pts/29 Aug 23 18:18 (DHCP-108-222.caltech.edu)
duello pts/37 Aug 22 20:26 (ruddock-190.caltech.edu)
qing pts/17 Aug 23 18:25 (Longbeard.library.caltech.edu)
schwab pts/33 Aug 23 07:27 (lps-133.umd.edu)
%
w
The w command is slower than the who command because it returns more information such as details about what programs people are running. It also returns a line containing the number of users and the system load average. The load average is the average number of processes ready to be run by the CPU and is a rough way of estimating how busy a system is.
% w
6:25pm up 7 day(s), 3:54, 70 users, load average: 1.56, 1.66, 1.70
User tty login@ idle JCPU PCPU what
rem pts/0 16Aug00 3:28 1 jsh
wjzhou pts/2 Sat12am 1:35 13 -csh
aji pts/13 6:22pm elm
lara pts/1 12:51pm 5:29 -tcsh
avayona pts/3 Tue 9pm 8:13 -tcsh
kmu pts/5 Sat 6pm 5 12 pine -i
shachi pts/7 Tue10pm 6:22 4 -tcsh
auddess pts/73 4:20pm 1:12 pine
htyu pts/6 Fri 7pm 43 11 7 pine
dswang pts/44 5:49pm 36 mail
surpi pts/8 10:28am 5 18 2 -csh
justa pts/87 4:47pm 12 3 3 pine -z
jasonmc pts/23 Sat 3pm 4:59 13 -csh
mkallis pts/16 6:13pm pine
marat pts/28 Sun 6pm 3days -tcsh
tanja pts/20 Mon 7pm 2 -csh
vineet pts/29 6:18pm pine
duello pts/37 Tue 8pm 59 1 1 pine
%
ps
The ps command used earlier to list your own processes can be used to list other users’ processes as well. who and w list logins but not individual processes on the system. They don’t list any of the running operating system processes which start when the computer is booted and which don’t have logins.
Since ps doesn’t use utmp, it is the program to use when you really want to find out what processes you might have accidentally left on the system or if another user is running any processes. Note that although ps might report processes for a user, it might be because that user has left a “background job” executing; the user is not really logged in. In this case you should see a “?” in the TTY field.
To get this fuller listing, use ps -ef. For more information on the uses of ps, type man ps.
top
top is an interactive command that displays and periodically updates the top cpu processes, ranked by raw cpu percentage. The default number of processes displayed is 15 but you can specify the number of processes with top number (e.g. to specify the top 10 processes enter top 10). You should see something like the following:
% top
load averages: 0.86, 0.39, 0.27 15:01:51
452 processes: 401 sleeping, 38 zombie, 11 stopped, 2 on cpu
CPU: 47.2% idle, 50.0% user, 2.8% kernel, 0.0% iowait, 0.0% swap
Memory: 512M real, 14M free, 419M swap in use, 131M swap free
PID USERNAME THR PRI NICE SIZE RES STATE TIME CPU COMMAND
19760 root 1 40 0 3240K 1872K sleep 0:00 0.81% sshd1
19586 marting 1 43 0 1984K 1648K cpu2 0:02 0.70% top.sun4u
19751 jasonmc 1 58 0 5360K 2944K sleep 0:00 0.14% pine
19763 samuelt 1 30 0 1352K 1120K sleep 0:00 0.12% csh
11406 avayona 1 58 0 2760K 1168K sleep 2:56 0.09% xbiff
19713 milamber 1 58 0 5384K 2968K sleep 0:00 0.07% pine
19683 rogero 1 58 0 5392K 3104K sleep 0:00 0.05% pine
18227 root 1 58 0 3248K 1816K sleep 0:00 0.05% sshd1
26085 tpkmc 1 58 0 5976K 4136K sleep 0:04 0.05% pine
19628 milley 1 58 0 2192K 1936K sleep 0:00 0.04% trn
%
As top is an interactive command the cursor will remain blinking above the PID column, waiting for the next command. If you only want to see a list of jobs by a specific user type the letter u. You will then be asked which username to you wish to show. To only show non-idle jobs use the -I flag.
To quit or cancel a job that is still running the kill command can be used within top. Simply enter the letter k and the cursor will prompt you with kill . Then enter the PID of the job you wish to cancel and . The process will then be killed. NB: If the job does not immediately disappear from the top listing, don’t worry. Wait a few seconds until the screen is updated and your job should be removed.
To quit top simply type the letter q.
finger
The finger program returns information about other users on the system who may or may not be logged in. finger by itself returns yet another variation of the list of currently logged in users. finger followed by a username or an e-mail -style address will return information about one or more users, the last time they logged into the system where you are fingering them, their full name, whether or not they have unread mail and the contents of two files they may have created: .plan and .project.
For more information about using finger or ways to provide information about yourself to others, type man finger.
% finger
Login Name TTY Idle When Where
rem Roger E. Murray pts/0 1 Wed 14:40 shada
wjzhou Weijun Zhou pts/2 1:36 Sat 00:59 relax.che.caltech.ed
lara Lara Hughes pts/1 5:31 Wed 12:51 wolf.eql.caltech.edu
avayona Anastasios Vayonakis pts/3 8:14 Tue 21:49 gondor.submm.caltech
kmu Ken Museth *pts/5 7 Sat 18:37 ken.gg.caltech.edu
shachi Shachi S. Gosavi pts/7 6:24 Tue 22:01 braun-103.caltech.ed
auddess Audrey Carstensen *pts/73 1:14 Wed 16:20 charter-DHCP-59.calt
htyu Haitao Yu pts/6 45 Fri 19:36 afar.carl.rhno.colum
dswang Deshen Wang pts/44 37 Wed 17:49 kuppermac2.caltech.e
surpi Gabriela C. Surpi pts/8 6 Wed 10:28 garfield.tapir.calte
justa Vikki Kowalski pts/87 14 Wed 16:47 30-233-44-208.user.d
jasonmc Jason S. McIlhaney pts/23 5:00 Sat 15:01 fleming-154.caltech.
mkallis Michelle Kristin All *pts/16 Wed 18:13 avery-70.caltech.edu
marat Marat Gataullin pts/28 2d Sun 18:20 hpl3cit2.cern.ch
devang Devang Shah *pts/13 Wed 18:26 node-64-249-49-50.ds
tanja Tanja Bosak *pts/20 2 Mon 19:00 131.215.64.118
vineet Vineet Gupta *pts/29 Wed 18:18 DHCP-108-222.caltech
duello Amy Duello *pts/37 1:00 Tue 20:26 ruddock-190.caltech.
qing Qing He pts/17 1 Wed 18:25 Longbeard.library.ca
%
December 21, 2008
Directory and File Structure
Directories
Directories in UNIX start at the root directory “/”. Files are fully specified when you list each directory branch needed to get to them.
/usr/local/lib/news
/home/pamela/src/file.c
Your Home Directory
A home directory can always be specified with ~username (~ is commonly called “twiddle,” derived from the proper term “tilde.”) If you needed to list files in someone else’s home directory, you could do so by issuing the command:
% ls ~username
substituting in their username. You can do the same with your own directory if you’ve cd‘d elsewhere. Please note: many people consider looking at their files an invasion of privacy, even if the files are not protected. Just as some people leave their doors unlocked but do not expect random passers-by to walk in, other people leave their files unprotected without intending to invite browsers.
Subdirectories
If you have many files or multiple things to work on, you probably want to create subdirectories in your home directory. This allows you to place files which belong together in one distinct place.
Creating Subdirectories
The program to make a subdirectory is mkdir. If you are in your home directory and wish to create a directory, type the command:
% mkdir directory-name
Once this directory has been created you can copy or move files to it (with the cp or mv commands) or you can cd to the directory and start creating files there.
File Manipulation
Copying Files
To copy a file use the cp command, specifying the name of the file you wish to be copied and the filename you wish to give the copied file:
% cp filename copy-filename
You can copy a file from the current directory into another subdirectory by entering:
cp filename directory-name
copy file, filename will be the same as original
cp filename directory-name/new-filename
copy file, give it a new name
Or cd into the new directory and move the file from elsewhere:
% cd directory-name
% cp ../filename .
copies the file from the directory above (represented by “..”) to the current directory (represented by “.”), giving it the same filename.
Moving Files
Files can be renamed or moved to different subdirectories using the mv command. The mv command works in a similar fashion to the cp command:
mv old-filename new-filename
renames original file with new-filename
mv filename directory-name/filename
move file to another directory, keeping the same filename
mv filename directory-name/new-filename
move file to another directory and renaming it new-filename
Removing Files and Directories
To remove files use the rm command, specifying the name of the file you want to remove (and the path if it is in another directory):
rm filename
removes file from current directory
rm directory-name/filename
removes file from another directory
rm ../filename
removes file from directory above
To remove a directory the command rmdir is used. NB: This command will only work if the directory speficied is empty. To remove a directory with files in it use the command rm -r directory-name (for recursive).
Interactive File Handling
To avoid unwanted deletion of precious files the mv and rm commands can be made interactive using the -i flag. For example rm -i filename would return a prompt asking if you are certain you want to delete tha t file. We recommend that you alias these commands to be interactive in your .cshrc file. For more help on aliasing see the aliases section later.
Finding Files
You can search for files using the find command, using the -name flag. The directory you wish to be searched must also be specified.
% find . -name myfile
looks for the file myfile in the current directory
% find directory/ -name myfile
looks for the file myfile in the directory given
File Names
Unlike other operating systems, filenames are not broken into a name part and a type part. Names can be many characters long and can contain most characters. Some characters such as * and ! have special meaning to the shell. They should not be used in filenames. If you ever do need to use such a symbol from the shell, they must be specified sneakily, by “escaping” them with a backslash (\). For example:
% rm \!badfile
C-shell would have interpreted rm !badfile differently. In that case, !badfile would have been replaced with the last command beginning with “badfile.” Chances are no such command would have existed, resulting in the error message badfile: Event not found. See the section on history for more information.
Specifying Files
There are two ways to specify files:
- fully, in which case the name of the file includes all of the directories, starting from the root director, “/”, or
- relatively, in which case the filename starts with the name of a subdirectory or consists solely of its own name.
When Charlotte Lennox (username lennox) created her directory arabella, all of the following sets of commands could be used to display the same file:
% more ~lennox/arabella/chapter1
or
% cd ~lennox
% more arabella/chapter1
or
% cd ~lennox/arabella
% more chapter1
The full file specification, beginning with a “/” is very system dependent. On the IMSS UNIX Cluster, all user directories are on the /home partition. This means that ~lennox on the IMSS UNIX Cluster would be the same as /home/lennox and that chapter1 would be fully specified by:
/home/lennox/arabella/chapter1
Disk Space Maintenance
It’s important to keep track of how much disk space you are using. The command du displays the disk usage of the current directory and all of its subdirectories. It displays the usage, in 512-byte units, for each directory, including any subdirectories it contains, and ends by displaying the total.
% du
Display disk usage of the current directory and its subdirectories.
% du -s
Display only total disk usage.
% du -s -k
Some versions of UNIX, such as Solaris, need -k to report kilobytes.
The df Program
To examine what disks and partitions exist and are mounted, you can type the df command at the % prompt. This should display partitions which have names like /dev/sd3g: 3 for disk 3, g for partition g. It will also display the space used and available in kilobytes and the “mount point” or directory of the partition.
Scratch Space
Users have home directories for storing permanent files. At various busy times of the year there may be shortages of disk space on the IMSS UNIX Cluster. You should use the du command to stay aware of how much space you are using and not try to exceed the system limits. For more information on user disk quotas see the FAQ – Quotas document.
Temporary scratch space is available in the event of a disk crunch, however, and can be used to store files which are extremely large or relatively unimportant. The scratch space is located in the /ccovol/suntmp directory. You should use the mkdir program to create a directory for yourself on either of these partitions.
Remember, because the scratch space is for temporary storage, you should delete the files as soon as you are done with them. This is particularly important if your files are large. If you forget to remove your files, they will be removed for you, but not until seven or more days after you last access them.
Displaying owner, group and permissions
The command ls -l filename will list the long directory list entry (which includes owner and permission bits) and the group of a file.
The display looks something like:
permission owner group filename
-rw-r----- hamilton ug munster_village
Protecting Files and Directories
When created, all files have an owner and group associated with them. The owner is the same as the username of the person who created the files and the group is the name of the creator’s default login group, such as faculty, grads, ug, etc.
Most users belong to one group on the IMSS UNIX computers, such as ug or faculty. If the owner of the file belongs to more than one group (you can display the groups to which you belong with the groups command) then the owner can change the group of the file between these groups. Otherwise, only the root account can change the group of a file.
Only the root account can change the ownership of a file.
The Permission Bits
The first position (which is not set) specifies what type of file this is. If it were set, it would probably be a d (for directory) or l (for link). The next nine positions are divided into three sets of binary numbers and determine permissions for three different sets of people.
u g o
421 421 421
rw- r-- ---
6 4 0
The file has “mode” 640. The first bits, set to “r + w” (4+2=6) in our example, specify the permissions for the user who owns the files (u). The user who owns the file can read or write (which includes delete) the file.
The next trio of bits, set to “r” (4) in our example, specify access to the file for other users in the same group (g) as the group of the file. In this case the group is ug — all members of the ug group can read the file (print it out, copy it, or display it using more).
Finally, all other users (o) are given no access to the file.
The one form of access which no one is given, even the owner, is “x” (for execute). This is because the file is not a program to be executed. It is probably a text file which would have no meaning to the computer. The x would appear in the third position if it was an excutable file.
Changing the Group and the Permission Bits
The group of a file can be changed with the chgrp command. Again, you can only change the group of a file to a group to which you belong. You would type as follows:
% chgrp groupname filename
You can change the protection mode of a file with the chmod command. This can be done relatively or absolutely. The file in the example above had the mode 640. If you wanted to make the file readable to all other users, you could type:
% chmod 644 filename
or
% chmod o+r filename
or
% chmod +4 filename
For more information see the man page for chmod.
Default Permissions: Setting the umask
All files are assigned a default set of permissions. To set the default, you must set the value of the variable umask. umask must be defined once per login (usually in the .cshrc file). Common umask values include 022, giving read and execute (or directory search) but not write permission to the group and others and 077 giving no access to group or other users for all new files you create. Note that the umask bits represent permissions not to be given (i.e. the opposite of what ls -l would show).
Creating Files
The cat Program
cat is one of most versatile commands. The simplest use of cat:
% cat .cshrc
displays your .cshrc file to the screen. Unix allows you to redirect output which would otherwise go to the screen by using a > and a filename. You could copy your .cshrc, for example, by typing:
% cat .cshrc > temp
This would have the same effect as:
% cp .cshrc temp
More usefully, cat will append multiple files together.
% cat .cshrc .login > temp
will place copies of your .cshrc and .login into the same file. Warning! Be careful not to cat a file onto an existing file! The command:
% cat .cshrc > .cshrc
may destroy the file .cshrc.
If you fail to give cat a filename to operate on, cat expects you to type in a file from the keyboard. You must end this with a -D on a line by itself. -D is the end-of-file character.
By combining the above two concepts, leaving off the name of a file to input to cat and telling cat to direct its output to a file with > filename, you can create files. For example:
% cat > temp
;klajs;dfkjaskj
alskdj;kjdfskjdf
-D
%
This will create a new file temp, containing the lines of garbage shown above. Note that this creates a new file. If you want to add things on to the end of an existing file you must use cat slightly differently. Instead of > you’d use >> which tells the shell to append any output to an already existing file. If you wanted to add a line onto your .cshrc, you could type
% cat >> .cshrc
echo "blah blah blah"
-D
%
This would append the line echo "blah blah blah" onto your .cshrc. Using > here would be a bad idea; it might obliterate your original .cshrc file.
Files as Output and Log Files
Ordinarily there are two types of output from commands: output to standard output (stdout) and to standard error (stderr). The > and >> examples above directed only standard output from programs into files. To send both the standard output and error to a file when using the C-shell, you should type >&:
% command >& filename
Logging Your Actions to a File
Sometimes you may wish to log the output of a login session to a file so that you can show it to somebody or print it out. You can do this with the script command. When you wish to end the session logging, type exit.
When you start up you should see a message saying script started, file is typescript and when you finish the script, you should see the message script done. You may want to edit the typescript file: visible ^M’s get placed at the end of each line because linebreaks require two control sequences for a terminal screen but only one in a file.
Text Editors
cat is fine for files which are small and never need to have real changes made to them, but a full-fledged editor is necessary for typing in papers, programs and mail messages. Among the editors available on the IMSS UNIX computers are pico, vi and emacs.
Be careful: not all UNIX editors keep backup copies of files when you edit them.
pico
pico is a simple, friendly editor. Type setup pine to set it up, pico filename to start it and man pine for more information about how to use it.
vi
vi is an editor which has a command mode and a typing mode. When you first startup vi (with the command vi filename) it expects you to enter commands. If you actually want to enter text into your file, you must type the insert command i. When you need to switch back to command mode, hit the escape key, usually in the upper left corner of your keyboard.
To move around you must be in command mode. You can use the arrow keys or use j, k, h, l to move down, up, left and right, respectively.
For more information type man vi.
Emacs
Emacs is a large editing system.
To use emacs, type:
% setup emacs
% emacs
Searching Through Files
The grep program can be used to search a file for lines containing a certain string:
% grep string filename
% grep -i string filename (case insensitive match)
or not containing a certain string:
% grep -v string filename
See the man page for grep. It has many useful options.
more and the vi editor can also find strings in files. The command is the same in both: type /string when at the --More-- prompt or in vi command mode. This will scroll through the file so that the line with “string” in it is placed at the top of the screen in more or move the cursor to the string desired in vi. Although vi is a text editor there is a version of vi called view, which lets you read through files but does not allow you to change them.
Comparing Files
The basic commands for comparing files are:
states whether or not the files are the same
lists line-by-line differences
three column output displays lines in file 1 only, file 2 only, and both files
See the man pages on these for more information.
File Types
When you list files in UNIX, it can be very hard to tell what kind of files they are. The default behavior of the ls program is to list the names of all the files in the current directory without giving any additional information about whether they are text files, executable files or directories. This is because the meaning of the contents of each file is imposed on it by how you use the file. To the operating system a file is just a collection of bytes.
There is a program file which will tell you information about a file (such as whether it contains binary data) and make a good guess about what created the file and what kind of file it is.
December 21, 2008
The UNIX Shell Syntax
As mentioned earlier, user commands are parsed by the shell. There are many shells other than the the C-shell which allow different types of shortcuts. We will only discuss the C-shell here, but some alternate shells installed on the IMSS UNIX Cluster include the Bourne shell (/bin/sh), the Bourne-Again Shell (bash), zsh and tcsh (a C-shell variant). The last three all reside in /usr/local/bin. While you are welcome to experiment with any of these shells, realize that C-shell is our default shell and that some IMSS UNIX Cluster utilities assume you are using it (and may not work if you’re not).
Changing Your Shell
To change your current shell to another use the chsh command (for change shell). You will then be prompted for your password and the new shell’s path (e.g. /usr/local/bin/tcsh for the tcsh shell). After enter ing these you will be informed that the login shell has been changed. To change to this shell logout and then re-login. For more information on changing your shell see the Changing Shell FAQ page.
The Path
One of the most important elements of the shell is the path. Whenever you type something at the % prompt, the C-shell first checks to see if this is an alias you have defined and, if not, searches all the directories in your path to determine the program to run.
The path is just a list of directories, delimited by colons, which are searched in order. Your default .cshrc will have a path defined for you. If you want other directories (such as a directory of your own programs) to be searched for commands, add them to your path by editing your .cshrc file. This list of directories is stored in the PATH environment variable. We will discuss how to manipulate environment variables later.
Flags and Parameters
Most commands expect or allow parameters (usually files or directories for the command to operate on) and many provide option flags. A flag, as we saw before, is a character or string with a - before it such as the -s we used with the ls command.
Some commands, such as cp and mv require file parameters. Not surprisingly, cp and mv (the copy and move commands) each require two: one for the original file and one for the new file or location.
It would seem logical that if ls by itself just lists the current directory then cp filename should copy a file to the current directory. Instead you must enter
% cp filename .
where the “.” tells cp to place the file in the current directory. filename in this case would be a long filename with a complete directory specification.
Not surprisingly, ls . and ls are almost the same.

