Linux Commands

Hello, I am sumit and currently pursing my final year of graduation with IT stream from JSPM BSIOTR Wagholi Pune. I am currently learning DevOps with TrainWIthShubham. I have prior knowledge of Java, JSP, Servlet, SQL and Data structure also.I am a hard worker, smart and quick learner.
"Linux commands" refer to the instructions you can input into a Linux terminal to perform specific tasks or operations. Commands are used to instruct the computer. we have to write commands on the shell (terminal). Shell forwards these commands to the kernel and the kernel forwards them to the hardware.
Some Basic Commands
View File Contents
Command:
cat filename.txtDescription: The
catcommand stands for "concatenate and display." It's primarily used to display the content of files.
Change File Permissions
Command:
chmod permissions filenameDescription:
chmod(change mode) is used to set or modify the permissions of a file or directory. Permissions determine who can read, write, or execute a file.
View Command History
Command:
historyDescription: The
historycommand displays the commands you've entered in your terminal session, allowing you to revisit or reuse previous commands.
Remove Directory
Command:
rmdir directorynameDescription:
rmdirremoves empty directories. If a directory has content, you would userm -r directoryname.
Create and View a File
Command:
bashCopy codetouch fruits.txt cat fruits.txtDescription:
touchcreates an empty file. Following this withcatallows you to view its contents, which would be empty in this case.
Add Content to a File
Command:
echo -e "Apple\nMango\nBanana\nCherry\nKiwi\nOrange\nGuava" > devops.txtDescription: The
echocommand is used for outputting text. With the-eflag, it interprets escaped characters like\nfor a new line. The>operator writes this output to a file.
Display Top Lines of a File
Command:
head -3 devops.txtDescription:
headdisplays the top lines of a file. The-3option specifies that only the top three lines should be shown.
Display Bottom Lines of a File
Command:
tail -3 devops.txtDescription: Conversely,
tailshows the bottom lines of a file, and the-3option ensures only the last three lines are shown.
Add Content to Another File
Command:
echo -e "Red\nPink\nWhite\nBlack\nBlue\nOrange\nPurple\nGrey" > Colors.txtDescription: This uses the same
echotechnique as before to add content to a new file.
Some short notes:
Some notes:
The
catcommand is used for viewing the content of files.The
chmodcommand is for changing file permissions.historydisplays a list of commands that you've previously entered.rmdirremoves an empty directory.touchcreates a new, empty file.echooutputs the specified text, and with the redirection>operator, you can write that output to a file. The-eflag allows the interpretation of escaped characters like\n(newline).headandtailare used to display the top or bottom lines of a file, respectively.The
diffcommand compares the contents of two files and displays the differences between them.




