Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 26
Linux Commands
• Linux commands are a type of Unix command or
shell procedure. • They are the basic tools used to interact with Linux on an individual level. Linux operating system is used on servers, desktops, and maybe even your smartphone. • It has a lot of command line tools that can be used for virtually everything on the system. • Linux commands are used to perform a variety of tasks, including displaying information about files and directories. • Linux commands are a type of Unix command or shell procedure. • They are the basic tools used to interact with Linux on an individual level. • Linux operating system is used on servers, desktops, and maybe even your smartphone. It has a lot of command line tools that can be used for virtually everything on the system. • Linux commands are used to perform a variety of tasks, including displaying information about files and directories. • Is – Displays information about files in the current directory. • pwd – Displays the current working directory. • mkdir – Creates a directory. • cd – To navigate between different folders. • rmdir – Removes empty directories from the directory lists. • cp – Moves files from one directory to another. • mv – Rename and Replace the files • rm – Delete files • uname – Command to get basic information about the OS • locate– Find a file in the database. • touch – Create empty files • ln – Create shortcuts to other files • cat – Display file contents on terminal • clear – Clear terminal • ps- Display the processes in terminal • man – Access manual for all Linux commands • grep- Search for a specific string in an output • echo- Display active processes on the terminal • wget – download files from the internet • whoami- Create or update passwords for existing users • sort- sort the file content • cal- View Calendar in terminal • whereis – View the exact location of any command types after this command • df – Check the details of the file system • wc – Check the lines, word count, and characters in a file using different options Is command
• The ls command is commonly used to identify the
files and directories in the working directory. This command is one of the many often-used Linux commands that you should know. • This command can be used by itself without any arguments and it will provide us the output with all the details about the files and the directories in the current working directory. There is a lot of flexibility offered by this command in terms of displaying data in the output. Check the below image for the output. pwd command
• The pwd command is mostly used to print the
current working directory on your terminal. It is also one of the most commonly used commands. • Now, your terminal prompt should usually include the entire directory. If it doesn’t, this is a quick command to see which directory you’re in. Another purpose for this command is when creating scripts because it can help us find the directory in which the script was saved. The below pictures are the output with the command. mkdir command
• This mkdir command allows you to create
fresh directories in the terminal itself. The default syntax is mkdir <directory name> and the new directory will be created. • For example, if you want to create a directory as “GeeksforGeeks” then the basic syntax would be: • mkdir GeeksforGeeks cd command
• The cd command is used to navigate between
directories. It requires either the full path or the directory name, depending on your current working directory. If you run this command without any options, it will take you to your home folder. rmdir command
• The rmdir command is used to delete
permanently an empty directory. To perform this command the user running this command must be having sudo privileges in the parent directory. cp command
• The cp command of Linux is equivalent to
copy-paste and cut-paste in Windows. mv command
• The mv command is generally used for
renaming the files in Linux. rm command
• rm command in Linux is generally used to
delete the files created in the directory uname command
• The uname command is used to check the
complete OS information of the system locate command
• The locate command is generally used to
locate the files in the database. Use an asterisk (*) to search for content that contains two or more words. As an example: locate first*file. This command will search the database for the files that contain these two names first and file. touch command
• The touch command creates an empty file
when put in the terminal in this format as touch <file name> ln command
• The ln command is used to create a shortcut
link to another file. This is among the most important Linux commands to know if you want to operate as a Linux administrator. cat command
• The cat command is the simplest command to
use when you want to see the contents of a particular file. The only issue is that it simply unloads the entire file to your terminal. If you want to navigate around a huge file, should use less command alternatively. clear command
• The clear command is a standard command to
clear the terminal screen. ps command
• ps command in Linux is used to check the
active processes in the terminal. man command
• The man command displays a user manual for
any commands or utilities available in the Terminal, including their name, description, and options. Command to view the full manual: • man <command name>For example, suppose you want to look up the manual for the ls command: man ls grep command
• The grep command is used to find a specific
string in a series of outputs. For example, if you want to find a string in a file, you can use the syntax: <Any command with output> | grep “<string to find> “ • For Example: • cat Files.txt | grep “new” echo command
• echo command in Linux is specially used to
print something in the terminal cal command
• The cal command is not the most famous
command in the terminal but it functions to view the calendar for a particular month in the terminal. Let’s see how this works. wc command
• wc command in Linux indicates the number of
words, characters, lines, etc using a set of options. • wc -w shows the number of words • wc -l shows the number of lines • wc -m shows the number of characters present in a file