Free Hosting Online for WorkStations

< Previous | Contents | Next >

4 – Manipulating Files And Directories‌


At this point, we are ready for some real work! This chapter will introduce the following commands:

cp – Copy files and directories

mv – Move/rename files and directories

mkdir – Create directories

rm – Remove files and directories

ln – Create hard and symbolic links

These five commands are among the most frequently used Linux commands. They are used for manipulating both files and directories.

Now, to be frank, some of the tasks performed by these commands are more easily done with a graphical file manager. With a file manager, we can drag and drop a file from one directory to another, cut and paste files, delete files, etc. So why use these old command line programs?

The answer is power and flexibility. While it is easy to perform simple file manipulations with a graphical file manager, complicated tasks can be easier with the command line programs. For example, how could we copy all the HTML files from one directory to an- other, but only copy files that do not exist in the destination directory or are newer than the versions in the destination directory? Pretty hard with a file manager. Pretty easy with the command line:



cp -u *.html destination

cp -u *.html destination


 

Top OS Cloud Computing at OnWorks: