Day 2- Basic Linux Commands

Introduction to Linux:
Linux is a free and open-source operating system kernel initially developed by Linus Torvalds in 1991.
It is widely used in various devices, from servers and desktop computers to smartphones and embedded systems.
Linux offers stability, security, and customization, making it a popular choice among tech enthusiasts, developers, and businesses.
Basic Linux Commands:
Check your present working directory:
Use the
pwdcommand to know your current location in the terminal.Example:
bashCopy code$ pwd /home/user/DocumentsList all files and directories (including hidden files):
Use the
lscommand to view the contents of the current directory.Example:
shellCopy code$ ls file1.txt file2.txt folder1 folder2 $ ls -a . .. .hidden_file file1.txt file2.txt folder1 folder2Create a nested directory A/B/C/D/E:
Use the
mkdircommand with the-poption to create nested directories.Example:
cssCopy code$ mkdir -p A/B/C/D/E
Change Directory (cd): Use the
cdcommand to navigate to a different directory.Example:
shellCopy code$ cd /home/user/DocumentsRemove Directory (rmdir): Use the
rmdircommand to remove an empty directory.Example:
shellCopy code$ rmdir empty_directoryRemove Files and Directories (rm): Use the
rmcommand with the-roption to remove directories and their contents.Example:
shellCopy code$ rm file.txt $ rm -r folderCopy Multiple Files (cp): Use the
cpcommand to copy multiple files to a destination directory.Example:
shellCopy code$ cp file1.txt file2.txt /home/user/Documents/Move Multiple Files (mv): Use the
mvcommand to move multiple files to a destination directory.Example:
shellCopy code$ mv file1.txt file2.txt /home/user/Documents/File Permissions (chmod): Use the
chmodcommand to change file permissions.Example:
shellCopy code$ chmod +x script.shDisplay File Contents (less): Use the
lesscommand to view the content of a file page by page.Example:
rubyCopy code$ less large_file.txtFile Count (wc): Use the
wccommand to count the number of lines, words, and characters in a file.Example:
shellCopy code$ wc file.txt 10 25 200 file.txtFind Files (find): Use the
findcommand to search for files or directories.Example:
arduinoCopy code$ find /home/user -name "file*.txt"Create and Edit Text Files (nano): Use the
nanocommand to create and edit text files in the terminal.Example:
rubyCopy code$ nano new_file.txt


