Thursday, September 24, 2020

VI-Command

  Basic UNIX Command:

·         pwd. When you first open the terminal, you are in the home directory of your user. ...

·         ls. The “Is” command is used to know what files are there in the directory you are in.

·         cd. Change directory

·         mkdir & rmdir. The mkdir command is used when you need to create a folder or a directory.

·         rm. ...

·         touch. ...

·         man & –help. ...

·         cp.

Ten ESSENTIAL UNIX Commands
These are ten commands that you really need to know in order to get started with UNIX. They are probably similar to commands you already know for another operating system.
Command Example Description
1.  ls :Lists files in current directory
ls -alF :List in long format
2.     cd
    cd tempdir :Change directory to tempdir 
cd .. :Move back one directory 
cd ~dhyatt/web-docs:Move into dhyatt's web-docs directory
3.  mkdir
mkdir graphics :Make a directory called graphics
4.  rmdir
rmdir emptydir :Remove directory (must be empty)
5.  cp
cp file1 web-docs :Copy file into directory
cp file1 file1.bak :Make backup of file1

6.  rm rm file1.bak :Remove or delete file
rm *.tmp :Remove all file
7.  mv
mv old.html new.html :Move or rename files

8.  more
more index.html :Look at file, one page at a time

9.  lpr
lpr index.html:Send file to printer

10. man
man ls Online manual (help) about command

Cursor Movement
h  move left (backspace)
j  move down
k  move up
l    move right (spacebar)
 [return]   move to the beginning of the next line
 
$    last column on the current line
0    move cursor to the first column on the current line
^    move cursor to first nonblank column on the current line
w  move to the beginning of the next word or punctuation mark
W    move past the next space
b  move to the beginning of the previous word or punctuation mark
B  move to the beginning of the previous word,ignores punctuation
e  end of next word or punctuation mark
E  end of next word, ignoring punctuation
H  move cursor to the top of the screen 
M  move cursor to the middle of the screen
L  move cursor to the bottom of the screen 
Inserting
r replace character under cursor with nextCharacter typed
R keep replacing character until [esc] is hit
i insert before cursor
a append after cursor
A append at end of line
O open line above cursor and enter append mode
Deleting
X delete character under cursor
dd delete line under cursor
dw delete word under cursor
db delete word before cursor
Copying Code
yy (yank)’copies’ line which may then be put bythe p(put) command. Precede with a count formultiple lines.
Put Command
brings back previous deletion or yank of lines, words, or characters
P bring back before cursor
P bring back after cursor
 Find Commands
? finds a word going backwards
/   finds a word going forwards
f inds a character on the line under thecursor going forward
F finds a character on the line under thecursor going backwards
t find a character on the current line goingforward and stop one character before it
T find a character on the current line goingbackward and stop one character before it
 ; repeat last f, F, t, T
Miscellaneous Commands
.     repeat last command
u     undoes last command issued
    undoes all commands on one line
xp     deletes first character and inserts aftersecond (swap)
    join current line with the next line
^G     display current line number
    if at one parenthesis, will jump to its mate
mx     mark current line with character x
‘x     find line marked with character x
NOTE: Marks are internal and not written to the file.

Describe the usage and functionality of the command “rm –r *” in UNIX?
The command “rm –r *” is a single line command to erase all files in a directory with its subdirectories.
“rm” – Is for deleting files.
“-r” – Is to delete directories and subdirectories with files within.
“*” – Is indicate all entries.

What is the behavioral difference between “cmp” and “diff” commands?
Both commands for file comparison.
Cmp – Compare given two files with byte by byte and display the first mismatch.
Diff – Display changes that need to done to make both file identical.

What are the duties of following commands?
chmod, chown, chgrp
chmod – Change the permission set of the file.
chown – Change ownership of the file.
chgrp – Change group of the file.

How to Kill a process in UNIX?
Syntax: kill PID



No comments:

Post a Comment

SOA Overview Part-1

  Middleware It provides a mechanism for the process to interact with other processes running on multiple network machines. Advantages...