Introduction to Top Commands in Linux
Commands in Linux are generally referred to as inbuilt Programs, whenever you run a particular command, it will execute a particular program and perform its operation. These commands are in a Linux terminal. A Linux terminal is something that provides a command-line interface that will allow the user to execute the commands.
Top Linux Commands
The Top Commands are explained below:
Displays the full path-name of the current working directory
To change the directory. If the directory is specified, the directory becomes the new working directory. Otherwise, it will take the user back to the user’s HOME directory
To create a new directory
Displays the files and subdirectories in the current directory
5. File Permissions Commands
Given below are some of the File Permissions:
This command can be named to put three authorization for all the three categories of file users. The individual who owns the file has access and uses the files. The chmod command uses an expression as its argument that joins, the operation, permission types and the category, by effectively using effective abbreviations. The below table shows the abbreviations that utilize the three factors of these expressions.
|u – user||+ assign permission||r – read permission|
|g – group||– remove permission||w – write permission|
|o – other||= assign absolute permission||x – execute permission|
|a – all|
- chmod u+x ppk: The command assign (+) executable (x) permission for the user (u), other permissions remaining unchanged.
- chmod ugo+x ppk: The string ugo combines all the three categories user, group and others
- chmod u+x ppk Syed Krishna: chmod also accepts more than one filename in the command line
6. Octal Notation
Some of the Octal Notation explained below:
chmod 666 ppk
The 6 indicates to read and write permissions (4+2)
The 4 indicates read permission
The 2 indicates write permission
The 1 indicates executable permission
7. File Copy Commands
Some of the Commands explained below:
- cp: The cp (copy) command copies a file or a group of files
cp [options] <source path | source file> <target path | target filename>
$cp ppk ppk1
If the destination file doesn’t exist. It will first be created before copying takes place. If not, it will simply be overwritten.
$cp ppk progs/ppk1
The file ppk is copied to the directory progs with the name ppk1.
$cp ppk01 ppk02 ppk03 progs
All files after copying will retain their original names. It is not possible to specify target filenames for each file, and copying takes place only if the progs directory exists. Remember that if these files are already resident in progs, then they will simply be overwritten.
Options in cp Commands
- -i –> Option
$ cp -i ppk ppk1
cp: overwrite ppk1? y
If the target file already exists then this option will ask the confirmation to overwrite it. If your choice is ‘y’ then it will overwrite the contents. If your choice is ‘n’ then it will not overwrite the contents.
- -r –> Recursive Option
$ cp -r progs new progs
It is now possible to copy an entire directory structure using the -r (recursive option). This will copy files and sub-directories in progs to new progs.
8. Deleting Commands
Given below are some of the Deleting Commands:
- rm: This command is used to delete the files
rm [options] [filename(s)]
$rm ppk ppk1
It will delete the files ppk and ppk1
It will remove all the files in the current directory
Options in Delete Commands
-i: $ rm -I ppk ppk1
If you press a y after this message, then the file will be deleted.
-r : $rm -r pethu
It will delete the pethu directory and its subdirectories.
9. Renaming File Commands
Some of the Renaming File Commands explained below:
- mv: This command is used to rename the files
$mv ppk ppk2
Rename the file ppk ppk2
$mv ppk pkk1 progs
Move the files ppk ppk1 to the progs directory
$mv progs progs1
It will rename directory progs to progs1
10. Calendar Commands
Given below are some of the Calendar Commands:
- cal: This command is used to print the calendar
If no argument is specified then it will print the previous month, current month & the next month.
$ cat Jan
It will print the current years January month calendar
$cat Jan 1996
It will print the 1996th year’s January month calendar
It will print the one-year calendar for the year 1996
11. Displaying the System Date Command
- date: It is used to print and set the date
- MM: Month number
- dd: Day number in the month
- hh: Hour number (24 – hour system)
- mm: Minute number
- yy: Last 2 digits of the year number(optional).
Prints the current date and time.
12. Login Details Commands
Given below are some of the Login Details Commands:
- who: Linux maintains an account of all the current users of the system. It is a good idea to know the people working on the various terminals so that you send them messages directly. A list of them is displayed by the who command, which, by default, produces a three -columnar.
$who am I
13. Comparing two files commands in Linux
Some of the Commands explained below:
- cmp: It compares two files and if they are different, display the byte and line number of the differences.
cmp [<option(s)>] <filename1> <filename2>
$cmp ppk ppk1
ppk ppk1 differ: char 9, line 1
Conclusion – Top Commands in Linux
Linux is an operating system with interface provider, but unlike other operating systems it has various advantages that make Linux a top priority it is an open-source operating system free of cost, secure compared to other OS, easily customized to our preferences and It is stable compared to windows especially when we are using large bits of data and even in the deployment process, the environments are mostly Linux hence various applications that are deployed in cloud uses Linux environment.
This is a guide to a Top Commands in Linux. Here we discuss the introduction, Top Linux Commands, Comparing two file commands and the Renaming Files. You can also go through our other suggested articles to learn more–