UNIX Notes
UNIX Notes
History of UNIX?
Scripting programming
1. It is an interpreter language 1.it is compiler base language
2. Interpreter converts HLL to MLL 2.compiler converts HLL to MLL as a whole
Line by line program in one short.
3. It does not generate .exe file 3.it generates .exe file
4. No need to compile the prog 4.need to compile the program
5. No need to link with library files 5.it links with library files
6. It requires few lines of code 6.it requires numerous lines of code
7. It reduces devpt time 7.it increase the devpt time
Shell scripting:
UNIX COMMANDS:
Basic commands:
2. Less file name: this command writes the content of a file onto the screen page at
at time.
8. Locate: it is useful for finding files when you don’t know exactly where they are
stored, what they will be called.
$locate filename
Filter commands:
2. Cut: it is used for to retrieve the required columns from the given file
3.sort: it is used to arrange the data.it arranges default based on ASCII values. The
default other is ascending order.
Sort-r it gives descending order
Sort-u it ignores duplicate files data
Sort –n numerical comparison
4.uniq:
Uniq-v it prints only non-duplicated lines
Uniq-d it prints only duplicated lines
Creating files:
$touch file name – it creates zero bytes file size
$cat > file name – to create file
Ctrl+d – to close a file
$cat >>file name – to opened data into the file
$cat file1 file2 file3 file4 – redirect output
$cat <file name (or) $ cast file name – to open a file
$rm file name – it removes a file
$rm-i file name – it asks confirmation before deleting the file
$rm file1 file2 file3- it removes 3 files
$rm * - it removes all files in current directory
$mkdir directory name – to creates directory
$mkdir dir1, dir2, dir3…dirn – to create multiple directories
$cd directory name – to change directory
$cd.. – to change into parent directory
$cd\ - to change to root directory
$rmdir directory name – to delete a directory but directory should be empty
$rm-r directory name- it removes all files and subdirectories
$cp file1 file2 – this will copy the contents of file1 into file2
$cp – i file1file2 – if file2 is already existed then its asks the confirmation
$mv old file name new file name – to rename the file
$cmp file 1 file2 – to compare file1 and file2
$more file – display a file a page at a time