In this repository we will learn about Linux commands. For using and implimenting those command open your linux command and press esc
button from your computer and enter vi
then enter file_name.sh
. Now you will redirect into mention fill now pressesc + a
for writing command. Now after complet writting progrma press esc + : + wq
now you will againg redirec to main command prompt. Now for running this file press sh file_name.sh
it will run whole commands of the file. Practice all code in vi editor.
⚠ Please read all the commands very carefully and write it using appropriate spaces and signs.
pwd
this command is used to check you are present in which directorymkdir DirectoryName
it use to create Directory.rmdir
orrm -d
used to remove empty directory.rm -r
to delete directory that contain sub-directory and file.ls
it shows the files/directories in your current directory.ls -R
to shows all the files not only in directories but also subdirectories.ls -al
gives detailed information of the files.ls -a
used to see hiden files (example of hiden files start with a.
).cat > filename
use to create file and after creating write something in that file.- After writing the content press
ctrl + d
to save the file and return to command. cat filename
use to see the content of file.cat file1 file2 > file3
command is used to combine files in to a new file.- You can merge more than two file using same command
rm filename
command is used to remove file from system without confirmation.mv filename directoryname
command is used to move file from one directory to anothercd directoryname
command is used to enter in any directory.cd
command is used to come back to previous directory.cat > filename
use to create filectrl + d
use to save the file and return to commandcat filename
use to see file detailscat file1 file2 > file3
use to combine files in to a new file.rm filename
used to remove file from system without confirmation.nano filename
use to edit existing fileecho "any thing"
use to printread variable_name
use to store value in a particular variableecho $variable_name
use to print assigned value of the variableexpr $variable1 + $variable2
use to print expretion commandvi filename.sh
use to open filename.sh in editorsh filename.sh
use to run filename.sh:wq
this command is used to exit from vi editor (if you are in editor moder then first useesc
)insert
orshift
+0
use to enable edit mode in vi editorfunction() {your shell} function
used to create function (yous curli braces in another line not in same line and end function is calling function).function() {"// your code $1 $2" return xy} function vagabon 09
here $1 $2 are paremater and vagabon 09 are passing parameter to function and return is returning parameter.function() { your shell script $1 $2}
next linefunction a b
next lineret=$?
in this way we can get values that passing by the function