File Handling commands
•
mkdir – make directories
Syntax: mkdir [OPTION] DIRECTORY...
eg. mkdir Dinesh
•
ls – list directory contents
Syntax: ls [OPTION]... [FILE]...
eg. ls, ls l, ls Dinesh
•
cd – changes directories
Syntax: cd [DIRECTORY]
eg. cd Dinesh1
•
pwd print name of current working directory
Syntax: pwd
• vim – Vi Improved, a programmers text editor
Syntax: vim [OPTION] [file]...
eg. vim file1.txt
cp – copy files and directories
Syntax: cp [OPTION]... SOURCE DEST
eg. cp sample.txt sample_copy.txt
cp sample_copy.txt target_dir
mv – move (rename) files
Syntax: mv [OPTION]... SOURCE DEST
eg. mv source.txt target_dir
mv old.txt new.txt
•
rm remove files or directories
Syntax: rm [OPTION]... FILE...
eg. rm file1.txt , rm rf some_dir
• find – search for files in a directory hierarchy
Syntax: find [OPTION] [path] [pattern]
eg. find file1.txt, find name file1.txt
•
history – prints recently used commands
Syntax: history
Text Processing
•
cat – concatenate files and print on the standard output
Syntax: cat [OPTION] [FILE]...
eg. cat file1.txt file2.txt
cat n file1.txt
•
echo – display a line of text
Syntax: echo [OPTION] [string] ...
eg. echo I love India
echo $HOME
•
grep print lines matching a pattern
Syntax: grep [OPTION] PATTERN [FILE]...
eg. grep i apple sample.txt
•
wc print the number of newlines, words, and bytes in files
Syntax: wc [OPTION]... [FILE]...
eg. wc file1.txt
wc L file1.txt
•
sort – sort lines of text files
Syntax: sort [OPTION]... [FILE]...
eg. sort file1.txt
sort r file1.txt
No comments:
Post a Comment