Here we will continue with the shell commands lessons now i will take about some command the first one is touch:
Creating Files with the touch The touch command is easy to use, and generally, there are two reasons to use it
1- create a file
2-update a file’s modification date.
The touch command has several options.
To create a file with touch, use
# touch newfile
# ls -l newfile
-rw-rw-r-- 1 bball bball 0 Nov 13 08:50 newfile
As you can see, touch created a file with size of zero. You can also use
# > newfile2
# ls -l new*
-rw-rw-r-- 1 bball bball 0 Nov 13 08:50 newfile
-rw-rw-r-- 1 bball bball 0 Nov 13 08:54 newfile2
Like touch, this creates a file with size of zero.
So why use touch Because touch will update a file’s date or time. You can use touch to change a file’s date or time to the past or the future, for example:
# touch newfile2
# ls -l newfile2
-rw-rw-r-- 1 bball bball 0 Nov 13 09:04 newfile2
As you can see, the file newfile2 now has a timestamp 10 minutes younger.
thes are the thing you can do by using touch command line.
Using rm to Delete files
This command use to remove (rm) the files and Should be used
cautiously. Why? Because when rm deletes a file, it is gone
Always running Linux while logged in as the root operator and using the rm command has caused many untold tales of woe and grief.
with this simple command you can delete out not only your Linux system, but also any mounted filesystems, including DOS partitions, flash RAM cards, or removable hard drives by using the command :
# rm -fr /*
The rm command can used to remove many file one time and you can use anyone of the following:
# rm file
# rm file1 file2 file2
# rm file*
the safest way to use this command is with the i option so you will be asked if you really want to remove this file or not as the next:
# rm -i new*
rm: remove `newfile’? y
rm: remove `newfile2'? y
You can also force file deletion by using the -f option, as in
# rm -f new*
If you try to use the rm command to delete a directory it will not work even if it's empty and you used the force option the file will give you an output saying he can't delete the directory as in:
# rm -f temp*
rm: temp: is a directory
rm: temp2: is a directory
But if you used the force and recursive option you will be able to remove directory:
# rm -fr temp*
becaues the force and recursive options make the rm command act like rmdir command so if you want to delete a directory use this command .
and that's for today and see you all in next lesson
ready to answer any questions

Get GNU / Linux
News Feed
Blogs
Event Photos
Screen Shots
Polls
Popular Content
Members
Search
Wall Papers