Skip to content

Basic file and directory-based commands

  • ls -la – for listing folder contents,  where the l option stands for long listing and the a option stands for all files (including the ones starting with a dot)
  • touch – for creating an empty text file
  • cd – for changing directories, both in absolute and relative terms
  • pwd – for showing the current directory
  • mkdir and rm – for creating and deleting a file or directory
  • cp and mv – for copying or moving a file or a directory
  • ln – for working with soft and hard links

The ls command can be used in a recursive mode with a capital letter R option, which means starting to list the content of a folder from that folder onward and going into all its subfolders.

Example:

$ ls -laR /etc/

By using the R option, we instructed the ls command to do its job in recursive mode.

We can also use ls to display the content of the folder and sort the output by using the last modified time:

$ ls -lat

By using the t option, we instructed the ls command to sort the output.

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Most Voted
Newest Oldest
Inline Feedbacks
View all comments