Linux is an open source operating system. Just like other operating system (Windows, Mac OS and Android etc.). An operating system is software that manages all of the hardware resourcess associated with your desktop or laptop.
A shell is user interface or an environment for accessing operating system services. Using shell we can run our command, program and shell script.
whereis
- Find the path of an executable file.
man <command_name>
- Get information about a command.
ls
- Show all the files and folders under a specific folder/directory.ls -a
- Show all the file/folder including hidden files.ls -al
- Show all the file/folder including hidden files with detailed information.ls -R
- Show all the file/folder in a directory and its subdirectory recursively.pwd
- It’s print current working directorycd <folder_name>
- Go to a specific folder/directory.cd .
- Go to the present directory.cd ..
- Go to the previous directory.cat <file_name>
- Read/display the data of a file.cat > <file_name>
- Create a new file.cat <file1> <file2> > <file3>
- Concatenate multiple files together.cat <file1> | tr a-z A-Z > <file2>
- Translate file1 data to uppercase and insert into file2.man <command_name>
- Get information about a command.mkdir <folder_name>
- use to create new folder/directorytouch <file_name>
- user to create empty new filecp <file_name> <destination>
- use to Copy a file.scp <file_name> username@destination_host:/home/folder_addr>
- it’s used to copy local to remote serverscp username@destination_host>:/home/folder/file_name /home/folder/file1
- it’s used to copy remote to lcoalman (use to give info about any command)
man <command_name>
- it’s give the info about commandstr (use to translate or delete the character)
cat <file1> | tr a-z A-Z > <file2>
- it’s traslate file1 data to upper case and insert into file2mv ( move or rename file/directory)
mv <source_file> <destination_file>
- its move to destination file
mv <source_file> <new_file>
- its rename the files
rm file_name
- remove files
-r
- Recursively delete directories and their contents.-f
- Forcefully delete files without asking.-i
- Prompt before deleting each file.-l
- Prompt only once before deleting multiple files.-v
- Verbosely list the files that are being deleted.df
- used to check the capacity and storage details.
-m
- in megabytes-h
- in gigabytesdu
- show the disk usage
-h
- human readablehead <file_name>
- display first 10 lines.tail <file_name>
- display last 10 lines.diff <file1> <file2>
- show the different between two fileslocate <file>
- to find out file.find <file/folder_name>
- Find a file/folder.find <dir_name
- find files inside directory.find .-type d
- Show only directory.
.-type f
- show only files..-type f -name "*.txt"
- Show only files with that specific name..-type f -iname "*.txt"
- Show only files with that specific name - not case sensitive.-type f -mmin -20
- Show files which modify less than 20 min ago..-type f -mmin +20
- show files which modify more than 20 min ago..-type f -maxdepth 2
- Will only show 1 folder deep..-size +1k
- will only show file/folder with size of 1kbchmod 777 <file_name>
- will change file permission accesschown <owner_name> <file_name>
- change file owner
i.e - chown root file1.txt
- file1.txt only access by root usergrep <text> <file_name>
- search text in files
-w <text> <file_name>
- search and show whole text-n <text> <file_name>
- show line number of text-i <text> <file_name>
- show text without case sensetive-c <text> <file_name>
- print the number of match found-v <text> <file_name>
- invert the search, so that only show the text that are not with searchgrep -win <text> ./*.txt
- search text in all .txt
file that is available in current directoryctrl+a
- cursor go to at start pointctrl+e
- cursor go to at end pointctrl+k
- remove all the word after the cursorctrl+u
- remove all the wordhistory
- To see all the previous used commandsnslookup
- To get the IP address of Domain name.
i.e - nslookup google.com
netstat
- To check the network status.hostname
- To check the hostname.whoami
- To check the current user.ping google.com
- To check the connectivity