EVERYTHING IN COMMAND LINE/ TERMINAL – MANIPULATION

Here, we learn about Manipulation of Files and Directories. For manipulation we use options.

  • ls -a = lists all files and directories including the hidden ones. Here, -a is an option.
pwd
/home/all/wild
  • ls -a = lists all files and directories including the hidden ones. Here, -a is an option. The hidden directories or files begin with a dot (.).
ls
animals  birds  flowers.txt
ls -a
. .. .local animals birds flowers.txt
  • ls -l = The -l option lists files and directories as a table. The -l option lists files and directories as a table.Here we see three rows, with seven columns separated by spaces. Here’s what each column means:
    1. Access rights. These are actions that are permitted on a file or directory.
    2. Number of hard links. This number counts the number of child directories and files. This number includes the parent directory link (..) and current directory link (.).
    3. The username of the file’s owner. Here the username is company.
    4. The name of the group that owns the file. Here the group name is staff.
    5. The size of the file in bytes.
    6. The date & time that the file was last modified.
    7. The name of the file or directory.
ls -l                                                                                       
total 8                                                                                     
drwxr-xr-x 4 company staff 4096 Jul  8 17:33 animals                                          
drwxr-xr-x 4 company staff 4096 Jul  8 17:36 birds                                                                                      
-rw-r--r-- 1 company staff    0 Jul  8 17:32 flowers.txt     
  • ls – t = lists all files and directories in the order of last modified. :
ls -t
birds animals flowers.txt
  • ls – alt = lists all files and directories including hidden ones, in long format, ordered by the date and time they were last modified.
ls -alt                                                                         
total 20                                                                          
drwxr-xr-x 5 company staff 4096 Aug 16 01:54 ..                                   
drwxr-xr-x 4 company staff 4096 Jul  8 17:57 .                                    
-rw-r--r-- 1 company staff    0 Jul  8 17:42 .local                           
drwxr-xr-x 2 company staff 4096 Jul  8 17:36 birds                               
drwxr-xr-x 2 company staff 4096 Jul  8 17:33 animals                            
-rw-r--r-- 1 company staff    0 Jul  8 17:32 flowers.txt 
  • cp <files or directories to copy> <destination> = used to copy files or directories to specified destination

cp biopic/ray.txt biopic/notorious.txt historical/

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s