Unix Command Summary
For some-more support upon a command, deliberate a great book, or have have have have make make make make make use of of of of of of of of of a male pages. For example, for some-more report upon grep, have have have have make make make make make use of of of of of of of of of a authority male grep.
cat? -? for formulating as well as displaying reduced files
This is a singular of a many stretchable Unix commands. We can have have have have make make make make make use of of of of of of of of of to create, perspective as well as concatenate files. For a initial e.g. you emanate a three-item English-Spanish compendium in a record called “dict.”
?? % cat >dict
???? red rojo
???? immature verde
???? blue azul
?? %
?? % cat dict
???? red rojo
???? immature verde
???? blue azul
?? %
If you instruct to supplement content to an existent record you do this:
?? % cat >>dict
???? white blanco
???? black negro
????
?? %
Now suspect which you have an additional record tmp which looks similar to this:
?? % cat tmp
???? cat gato
???? dog perro
?? %
Then you can stick upon dict as well as tmp similar to this:
?? % cat dict tmp >dict2
We could check a series of lines in a brand new record similar to this:
?? % wc -l dict2
8
The authority wc counts things — a series of characters, words, as well as line in a file.
——————————————————————————–
chmod — shift permissions
This authority is used to shift a permissions of a record or directory. For e.g. to have a record essay.001 entertaining by everyone, you do this:
?? % chmod a+r essay.001
To have a file, e.g., a bombard book mycommand executable, you do this
?? % chmod +x mycommand
Now you can run mycommand as a command.
To check a permissions of a file, have have have have make make make make make use of of of of of of of of of ls -l . For some-more report upon chmod, have have have have make make make make make use of of of of of of of of of male chmod.
——————————————————————————–
cd — shift office
Use cd to shift directory. Use pwd to see what office you are in.
?? % cd english
?? % pwd
?? % /u/ma/siya/english
?? % ls
novel poems
?? % cd novel
?? % pwd
?? % /u/ma/siya/english/novel
?? % ls
ch1 ch2 ch3 biography scrapbook
?? % cd ..
?? % pwd
?? % /u/ma/siya/english
?? % cd poems
?? % cd
?? % /u/ma/siya
——————————————————————————–
cp — for duplicating files
Use cp to duplicate files or directories.
?? % cp foo foo.2
This creates a duplicate of a record foo.
?? % cp ~/poems/jabber .
This copies a record rave in a office poems to a stream directory. The pitch “.” stands for a stream directory. The pitch “~” stands for a home directory.
——————————————————————————–
date — arrangement date
Use this authority to check a date as well as time.
?? % date
Mon May? 3 10:25:33 IST 2010
——————————————————————————–
echo — relate evidence
The relate authority echoes a arguments. Here are a little examples:
?? % relate this
???? this
?? % relate $EDITOR
???? /usr/local/bin/emacs
?? % relate $PRINTER
???? b129lab1
Things similar to PRINTER are supposed sourroundings variables. This a singular stores a name of a default printer — a a singular which imitation jobs will go to unless you take a little movement to shift things. The dollar pointer prior to an sourroundings non-static is indispensable to get a worth in a variable. Try a following to determine this:
?? % relate PRINTER
???? PRINTER
——————————————————————————–
ftp — bond to a remote appurtenance to download or upload files
Use ftp to bond to a remote machine, afterwards upload or download files. See also: ncftp
Example 1: We’ll bond to a appurtenance fubar.net, afterwards shift executive to mystuff, afterwards download a record homework11:
?? % ftp solitude
???? Connected to fubar.net.
???? 220 fubar.net FTP server (Version wu-2.4(11) Mon April eighteen 17:26:33 MDT 1994) ready.
?? Name (solitude:carlson): jeremy
???? 331 Password compulsory for jeremy.
?? Password:
???? 230 User jeremy logged in.
?? ftp> cd mystuff
? ???250 CWD authority successful.
?? ftp> get homework11
?? ftp> quit
Example 2: We’ll bond to a appurtenance fubar.net, afterwards shift executive to mystuff, afterwards upload a record collected-letters:
?? % ftp solitude
???? Connected to fubar.net.
???? 220 fubar.net FTP server (Version wu-2.4(11) Mon April eighteen 17:26:33 MDT 1994) ready.
?? Name (solitude:carlson): jeremy
???? 331 Password compulsory for jeremy.
?? Password:
???? 230 User jeremy logged in.
?? ftp> cd mystuff
???? 250 CWD authority successful.
?? ftp> put collected-letters
?? ftp> quit
The ftp module sends files in ascii (text) format unless you mention binary mode:
?? ftp> binary
?? ftp> put foo
?? ftp> ascii
?? ftp> get bar
The record foo was eliminated in binary mode, a record club was eliminated in ascii mode.
——————————————————————————–
grep — poke record
Use this authority to poke for report in a record or files. For example, suspect which you have a record dict whose essence are
?? red rojo
?? immature verde
?? blue azul
?? white blanco
?? black negro
Then you can demeanour up equipment in a record similar to this;
?? % grep red dict
???? red rojo
?? % grep blanco dict
???? white blanco
?? % grep brownish-red dict
?? %
Notice which no outlay was returned by grep brown. This is given “brown” is not in a compendium file.
Grep can additionally be total with alternative commands. For example, if a singular had a record of phone numbers declared “ph”, a singular entrance per line, afterwards a following authority would give an in a order of a alphabet list of all persons whose name contains a fibre “Fred”.
?? % grep Fred ph | sort
???? Alpha, Fred: 333-6565
???? Beta, Freddie: 656-0099
???? Frederickson, Molly: 444-0981
???? Gamma, Fred-George: 111-7676
???? Zeta, Frederick: 431-0987
The pitch “|” is called “pipe.” It pipes a outlay of a grep authority in to a submit of a arrange command.
For some-more report upon grep, deliberate
?? % male grep
——————————————————————————–
head — arrangement initial partial of record
Use this authority to demeanour during a conduct of a file. For example,
?? % conduct essay.001
displays a initial 10 lines of a record essay.001 To see a specific series of lines, do this:
?? % conduct -20 essay.001
This displays a initial twenty lines of a file.
——————————————————————————–
ls — see what files you have
Use ls to see what files you have. Your files are kept in something called a directory.
?? % ls
???? foo?????? letter2
???? foobar??? letter3
???? letter1?? maple-assignment1
?? %
Note which you have 6 files. There are a little utilitarian variants of a ls command:
?? % ls l*
???? letter1 letter2 letter3
?? %
Note what happened: all a files whose name starts with “l” are listed. The asterisk (*) is a ” wildcard” character. It matches any string.
——————————————————————————–
lpr — customary imitation authority (see additionally imitation )
This is a customary Unix authority for copy a file. It stands for a very old “line printer.” See
?? % male lpr
for report upon how it works. See imitation for report upon a internal smart imitation command.
——————————————————————————–
more — have have have have make make make make make use of of of of of of of of of to review files
More is a authority used to review content files. For example, you could do this:
?? % some-more poems
The outcome of this to let you review a record “poems “. It substantially will not fit in a singular screen, so you need to know how to “turn pages”. Here are a simple commands:
q — give up some-more
spacebar — review subsequent page
return pass — review subsequent line
b — go behind a singular page
For still some-more information, have have have have make make make make make use of of of of of of of of of a authority male more.
——————————————————————————–
mkdir — emanate office
Use this authority to emanate a directory.
?? % mkdir essays
To get “into” this directory, do
?? % cd essays
To see what files are in essays, do this:
?? % ls
There shouldn’t be any files there yet, given you only done it. To emanate files, see cat or emacs.
——————————————————————————–
mv — for relocating as well as renaming files
Use this authority to shift a name of record as well as directories.
?? % mv foo foobar
The record which was declared foo is right away declared foobar
——————————————————————————–
ncftp — generally great for downloading files around unknown ftp.
Use ncftp for unknown ftp — which equates to you do not have to have a password.
?? % ncftp ftp.fubar.net
???? Connected to ftp.fubar.net
?? > get jokes.txt
The record jokes.txt is downloaded from a appurtenance ftp.fubar.net.
——————————————————————————–
print — law imitation authority (see additionally lpr )
This is a tolerably smart imitation command.
?? % imitation foo
?? % imitation notes.ps
?? % imitation manuscript.dvi
In any box imitation does a right thing, in any case of either a record is a content record (like foo ), a postcript record (like notes.ps, or a dvi record (like manuscript.dvi. In these examples a record is printed upon a default printer. To see what this is, do
?? % print
and review a summary displayed. To imitation upon a specific printer, do this:
?? % imitation foo jwb321
?? % imitation notes.ps jwb321
?? % imitation manuscript.dvi jwb321
To shift a default printer, do this:
?? % setenv PRINTER jwb321
——————————————————————————–
pwd — find out what office you are in
Use this authority to find out what office you are operative in.
?? % pwd
/u/ma/jeremy
?? % cd homework
?? % pwd
/u/ma/jeremy/homework
?? % ls
assign-1 assign-2 assign-3
?? % cd
?? % pwd
/u/ma/jeremy
?? %
——————————————————————————–
rm — mislay a record
Use rm to mislay files from your directory.
?? % rm foo
???? mislay foo? y
?? % rm letter*
???? mislay letter1? y
???? mislay letter2? y
???? mislay letter3? n
?? %
The initial authority private a singular file. The second authority was dictated to mislay all files commencement with a fibre “letter.” However, a user (Jeremy?) motionless not to mislay letter3.
——————————————————————————–
rmdir — mislay office
Use this authority to mislay a directory. For example, to mislay a office called “essays”, do this:
?? % rmdir essays
A office contingency be dull prior to it can be removed. To dull a directory, have have have have make make make make make use of of of of of of of of of rm.
——————————————————————————–
rsh — remote bombard
Use this authority if you wish to work upon a mechanism opposite from a a singular you are now operative on. One reason to do this is which a remote appurtenance competence be faster. For example, a authority
?? % rsh solitude
connects you to a appurtenance solitude. This is a singular of a open workstations as well as is sincerely fast.
See also: telnet
——————————————————————————–
setenv — set an sourroundings non-static
?? % relate $PRINTER
???? labprinter
?? % setenv PRINTER myprinter
?? % relate $PRINTER
???? myprinter
——————————————————————————–
sort — arrange record
Use this commmand to arrange a file. For example, suspect you have a record dict with essence
red rojo
green verde
blue azul
white blanco
black negro
Then you can do this:
?? % arrange dict
???? black negro
???? blue azul
???? immature verde
???? red rojo
???? white blanco
Here a outlay of arrange went to a screen. To store a outlay in record you do this:
?? % arrange dict >dict.sorted
You can check a essence of a record dict.sorted regulating cat , some-more , or emacs .
——————————————————————————–
tail — arrangement final partial of record
Use this authority to demeanour during a tail of a file. For example,
?? % conduct essay.001
displays a final 10 lines of a record essay.001 To see a specific series of lines, do this:
?? % conduct -20 essay.001
This displays a final twenty lines of a file.
——————————————————————————–
tar — emanate an archive, supplement or remove files
Use emanate dense repository of directories as well as files, as well as additionally to remove directories as well as files from an archive. Example:
?? % connect -tvzf foo.tar.gz
displays a record names in a dense repository foo.tar.gz whilst
?? % connect -xvzf foo.tar.gz
extracts a files.
——————————————————————————–
telnet — record in to an additional appurtenance
Use this authority to record in to an additional appurtenance from a appurtenance you are now operative on. For example, to record in to a appurtenance “solitude”, do this:
?? % telnet solitude
See also: rsh.
——————————————————————————–
top — arrangement a many apparatus immoderate processes in a next format
CPU TTY? PID USERNAME PRI NI?? SIZE??? RES STATE??? TIME %WCPU? %CPU COMMAND
?0?? ? 19984 root???? 240 20? 2268K?? 576K run????? 0:33 28.76 28.71 gzip
——————————————————————————–
wc — equate characters, words, lines
Use this authority to equate a series of characters, words, as well as lines in a file. Suppose, for example, which you have a record dict with essence
red rojo
green verde
blue azul
white blanco
black negro
Then you can do this
?? % wc dict
???? 5????? 10????? 56? dict
This shows which dict has 5 lines, 10 words, as well as 56 characters.
The word equate authority has multiform options, as with pictures below:
?? % wc -l dict
???? 5 dict
?? % wc -w dict
???? 10 dict
?? % wc -c dict
???? 56 dict
——————————————————————————–
All Questions And Answers for IT Realted Interviews.This Knowledgebase will be Very beneficial to a IT students.
Tags: a-file-dict, directory, file, files, following, home, local, permissions, the-file, unix, user





