Introduction:
In this post I am introducing UNIX Commands
for UNIX Beginners who need details of commands
that are likely to be of to use them. UNIX is a
Computer Operating System.This OS has backbone
of the Internet especially for large servers.This is
a free version of UNIX called as linux . This linux
has most popular OS which is used by major software
organisations for good performance.Unix was developed
around in 1969 at AT & T labs by Dennis Ritche and
ken Thompson.why unix has rapidly growing in the
industry means it has the capability to take activities
from multiple user at the same time.
Here are the some essential commands in order to get start with UNIX.
CD: change directory
It is used to change from one directory to another
Ex:
cd lucky
Here will change the directory from current to lucky directory.
ls
When ever you log in your current working directory is home directory. so to find out list of all files in your home directory you need to write this command.
Ex:
% ls
ls -a
This command is used when you want show list of all files whose names begin with a dot in current directory.
Ex:
% ls -a
Note: Here -a is an option. option changes the behavior of command.
ls -l
This command is used to list of all the file names,permissions etc.. in long format.
mkdir
This command is used to create new directory.suppose you have home directory,In that home directory you can create sub directory(new directory) to place all your list of files.
Ex:
% mkdir lucky (here we create new directory with name lucky)
To see all your content in the lucky directory which command you will used?
Ans: % ls (Got it )
pwd(print working directory)
This command is used to find out to absolute path name of your home directory.
EX:
% pwd
The full path name will look like this:
/home/programs/core/lucky
cp(copy)
This command is used to copy a file,if you want copy old file in your a current directory file named as new file.
cp oldfile newfile
I will give example how to copy file, I have a directory named as lucky then write
% cd ~/lucky
Then your write immediately on unix prompt,
% cp examples/core/books.txt .
NOTE: At the end you must specify . that means your current directory
Mv:(move)
This command is used to move files from one directory to another directory.It can also be used rename a file,by moving the file to the same directory,but giving different names.
mv oldfile newfile
This command will rename oldfile to newfile
rm(remove),rmdir(remove directory):
This command is used to delete(remove)a file.
suppose you have file named with books.txt then you to write the command like this
% rm books.txt(here delete file named with books.txt)
If we want create directory we use mkdir command ,to delete directory we use rmdir.
Ex:
% rmdir lucky
Note: make sure the directory is empty before deleting directory
clear:
This command is used to clear the terminal window of previous commands before you start next section.
Ex:
% clear
cat(concatenate)
This command is used to display the contents of the files on the screen.
Suppose if you want to see books.txt file content, then you have to type like this
% cat books.txt
head
This command is used to see first 10 lines of a file on the screen.Before checking this command clear the screen first then check it.
Ex: % head books.txt
tail
This command is used to writes the last ten lines of a file to the screen.
Ex: % tail books.txt
Grep
This command is used to search files for specified words or patterns.
% grep java books.txt
In above command grep has printed out each line containing the word java
grep is case sensitive; so be careful about it since Java and java is difference.
Wc(word count)
This command is used to count the words in your file.
Ex:
% wc -w books.txt
To find home many lines the file has,then type
% wc -l books.txt
sort
This command is used to sort the lines of files or file in Ascending order.
Example
Suppose, you have a file named with books.txt,
java
dbms
c
artificial intelligence
python
big data
if you run this books.txt file with sort command then result look like this:
% sort books.txt
artificial intelligence
big data
c
dbms
java
python
vi
This command is used to launches a vi sual editor.To edit a file type.
In all Unix version the default editor is vi editor.If you want write characters you will need to hit i to be in insert mode and then start typing. some options for insert mode
In this post I am introducing UNIX Commands
for UNIX Beginners who need details of commands
that are likely to be of to use them. UNIX is a
Computer Operating System.This OS has backbone
of the Internet especially for large servers.This is
a free version of UNIX called as linux . This linux
has most popular OS which is used by major software
organisations for good performance.Unix was developed
around in 1969 at AT & T labs by Dennis Ritche and
ken Thompson.why unix has rapidly growing in the
industry means it has the capability to take activities
from multiple user at the same time.
Here are the some essential commands in order to get start with UNIX.
CD: change directory
It is used to change from one directory to another
Ex:
cd lucky
Here will change the directory from current to lucky directory.
ls
When ever you log in your current working directory is home directory. so to find out list of all files in your home directory you need to write this command.
Ex:
% ls
ls -a
This command is used when you want show list of all files whose names begin with a dot in current directory.
Ex:
% ls -a
Note: Here -a is an option. option changes the behavior of command.
ls -l
This command is used to list of all the file names,permissions etc.. in long format.
mkdir
This command is used to create new directory.suppose you have home directory,In that home directory you can create sub directory(new directory) to place all your list of files.
Ex:
% mkdir lucky (here we create new directory with name lucky)
To see all your content in the lucky directory which command you will used?
Ans: % ls (Got it )
pwd(print working directory)
This command is used to find out to absolute path name of your home directory.
EX:
% pwd
The full path name will look like this:
/home/programs/core/lucky
cp(copy)
This command is used to copy a file,if you want copy old file in your a current directory file named as new file.
cp oldfile newfile
I will give example how to copy file, I have a directory named as lucky then write
% cd ~/lucky
Then your write immediately on unix prompt,
% cp examples/core/books.txt .
NOTE: At the end you must specify . that means your current directory
Mv:(move)
This command is used to move files from one directory to another directory.It can also be used rename a file,by moving the file to the same directory,but giving different names.
mv oldfile newfile
This command will rename oldfile to newfile
rm(remove),rmdir(remove directory):
This command is used to delete(remove)a file.
suppose you have file named with books.txt then you to write the command like this
% rm books.txt(here delete file named with books.txt)
If we want create directory we use mkdir command ,to delete directory we use rmdir.
Ex:
% rmdir lucky
Note: make sure the directory is empty before deleting directory
clear:
This command is used to clear the terminal window of previous commands before you start next section.
Ex:
% clear
cat(concatenate)
This command is used to display the contents of the files on the screen.
Suppose if you want to see books.txt file content, then you have to type like this
% cat books.txt
head
This command is used to see first 10 lines of a file on the screen.Before checking this command clear the screen first then check it.
Ex: % head books.txt
tail
This command is used to writes the last ten lines of a file to the screen.
Ex: % tail books.txt
Grep
This command is used to search files for specified words or patterns.
% grep java books.txt
In above command grep has printed out each line containing the word java
grep is case sensitive; so be careful about it since Java and java is difference.
Wc(word count)
This command is used to count the words in your file.
Ex:
% wc -w books.txt
To find home many lines the file has,then type
% wc -l books.txt
sort
This command is used to sort the lines of files or file in Ascending order.
Example
Suppose, you have a file named with books.txt,
java
dbms
c
artificial intelligence
python
big data
if you run this books.txt file with sort command then result look like this:
% sort books.txt
artificial intelligence
big data
c
dbms
java
python
vi
This command is used to launches a vi sual editor.To edit a file type.
In all Unix version the default editor is vi editor.If you want write characters you will need to hit i to be in insert mode and then start typing. some options for insert mode
- A appends the text at the end of the line
- a appends the text after cursor
- O open a new line of text above cursor
- o open a new line of the text below cursor
For command mode
- yy to copy a line to buffer
- p to paste text from buffer
- x to delete a single character
- ndd to delete n number of lines
- dd to delete entire line
- nyy copy n number of line to buffer
- $ to move end of the line
- lG to go to the first line of the file
- /string to search string in a file
- n to search for next occurrence of a file
No comments:
Post a Comment