File Extension
|
Description
|
.txt
|
Refers to text file
|
.gif
|
Refers to Graphics interchange format image
|
.jpg
|
Refers to Joint Photographic Experts Group image
|
.mp3
|
Refers to MPEG-2 Layer 3 audio
|
.gz
|
Regers to compressed file
|
.tar
|
Regers to Unix ‘tape arhive’file
|
.tar.gz.tgz
|
Refers to compressed archive file
|
Visiting
Directories with cd
· You can change to
other directory from the current working directory by using the cd
command. For exaple if you want src to
be your current directory, then type the following
$ cd
/usr/src
· If you donot give the directory name as an argument, the cd
command navigates you to the home directory.
You
can use pwd command to find out the current directory. Syntax for finding the
current directory is : $ pwd
V. filename Completion
·
Modern shells jprovides you ne of the most useful features
of the Linux command line that is automatic file name completion. You do not
have to type to type the complete file names at the Linux command line. Type only the beginnging f a file name in the
command line and press the Tab key and the shell sbompletes the rest.
·
There may be several files that start with the same letters
but have different endings. When you
have typed the first letters of a file name and press the Tab key, the shell
completes as much as it can and beeps.
When you press the Tab key againn, the shell shows you all the
alternatives.
i.
Wildcard
patterns
·
Give commands
multiple files by specifying patterns
·
You can use the * symbol to match any part of a
filename. For example:
$ ls
*.txt
Accounts.txt
letter.txt report.txt
ii.
Copying Files with cp
·
You can copy files by using the syntax:
Cp [options] source-file destination-file
·
You can copy
multiple files into a directory by using the syntax:
Cp files directory
·
Common options used with cp
comand are:
- -f: overwites the
destination files
- -i: prompts you
befor overwriting files
- -a: archive, copy
the contents of directories recursively
i.
Examples of Cp command
·
Copy /etc/smb.conf to the current directory
$ cp
/etc/smb.conf
·
Create an identical copy of a directory called work, and call
it work –backup:
$ Cp –a work work-backup
·
Copy all the GIF and JPEG images in the current directory
into images:
$ Cp *.gif*. jpeg images/
ii.
Moving Files
with mv
·
You can rename files or directories, or move them to
different directories by using the mv command
·
Options used with mv command:
- -f: overwrites the
destination file, even if target aleady exists
- -i: asks user
interactively before overwiting files
·
For example, to rename poetry.txt to poems.txt, the command
is:
Basic File Managemant (Part-2)
$ mv poetry. Txt poems.txt
·
To move the content of the current
directory at some other laocation, the command is :
$ mv * -/old-stuff/
NEXT-PART