Basic Linux commands
ls
- Lists the files and directories in the current directory.cd
- Changes the current directory. For example,cd /var/www
would change the current directory to /var/www.mkdir
- Creates a new directory. For example,mkdir DevOps
would create a new directory named "DevOps".rm
- Deletes files and directories. For example,rm myfile.txt
would delete the file "myfile.txt".rmdir
- Deletes a directory. For example,rmdir DevOps
would delete the directory "DevOps".cp
- Copies a file from one location to another. For example,cp file1.txt /home/user/
would copy the file "file1.txt" to the directory /home/user/.mv
- Moves or renames a file. For example,mv file1.txt /home/user/newfile.txt
would move the file "file1.txt" to the directory /home/user/ and rename it to "newfile.txt".cat
- Displays the contents of a file. For example,cat file1.txt
would display the contents of the file "file1.txt".
9. grep
- Searches for a specific string in a file. For example, grep "hello" file1.txt
would search for the string "hello" in the file "file1.txt".
These are just a few of the many commands available in Linux.
Day-2 Task
- Check your present working directory.
pwd
List all the files or directories including hidden files.
ls -a
3. Create a nested directory A/B/C/D/E
mkdir -p A/B/C/D/E