Basic file and directory-based commands
Let's discuss various shell commands that can be used to work with files and directories. In a nutshell, what we're interested in are these commands:
ls
– for listing folder contentstouch
– for creating an empty text filecd
– for changing directories, both in absolute and relative termspwd
– for showing the current directorymkdir
andrm
– for creating and deleting a file or directorycp
andmv
– for copying or moving a file or a directoryln
– for working with soft and hard links
These commands are some of the most frequently used commands in the everyday life of a system administrator/engineer. Let's see what they are all about.
Getting ready
We need to go through these commands to really understand what happens on the filesystem as we execute them. So, let's make sure that our cli1
machine is running and let's do it!