Navigating the Linux filesystem

pwd     
 
[root@localhost agi-bin]# pwd 
/var/lib/asterisk/agi-bin 
[root@localhost agi-bin]#

 

cp   
 
# Below we will copy the fax.agi script to the /tmp/ directory 
[root@localhost agi-bin]# cp fax.agi /tmp/ 
[root@localhost agi-bin]#   
 
# Below we will use the copy command to make a new copy of fax.agi called fax.agi.old to keep a backup copy of the  
# script before we edit the file in the same directory that we are currently is which is the agi-bin directory 
[root@localhost agi-bin]# cp fax.agi fax.agi.old 
 
# To Copy a whole directory we need to pass the -r flag to tell it to recursively copy the directory.
# we will copy the whole modules directory to the tmp directory.  This will copy everything in modules dirctory
# and any dub directories within the modules directory.
[root@localhost agi-bin]# cp -rf /var/www/html/admin/modules/ /tmp/
 
# If we wanted to copy all files that ended in a .conf name from the /etc/asterisk/ directory to the
# current directory that we are in we could use the following command.
# The * is a wild character so *.conf means any file that has some characters and ends in .conf.
# The . at the end tells the copy command to copy the files into our current directory we are in.  You could easily
# replace the . with a directory path like /tmp/
[root@localhost tmp]# cp /etc/asterisk/*.conf .

 

mv     
 
 
# Below we will move the fax.agi script to the /tmp/ directory 
[root@localhost agi-bin]# mv fax.agi /tmp/ 
[root@localhost agi-bin]#   
 
# Below we will use the move command to rename fax.agi to fax.agi.save 
[root@localhost agi-bin]# mv fax.agi fax.agi.save 
[root@localhost agi-bin]#