Forums
New posts
Search forums
News
Security News
Technology News
Giveaways
Giveaways, Promotions and Contests
Discounts & Deals
Reviews
Users Reviews
Video Reviews
Support
Windows Malware Removal Help & Support
Inactive Support Threads
Mac Malware Removal Help & Support
Mobile Malware Removal Help & Support
Blog
Log in
Register
What's new
Search
Search titles only
By:
Search titles only
By:
Reply to thread
Menu
Install the app
Install
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Forums
Software
Operating Systems
ChromeOS & Linux
A Beginner's Guide to the Linux Command Line
Message
<blockquote data-quote="BoraMurdar" data-source="post: 227416" data-attributes="member: 2291"><p><span style="font-size: 15px"><strong>1. What is a home directory in Linux?</strong></span></p><p>Linux is a multi-user operating system, which means that more than one user can access the OS at the same time. To make things easy, each user is assigned a directory where they can store their personal files. This directory is known as a user's home directory.</p><p></p><p>Home directories are found under the <em>home</em> directory. For example, my home directory is<em>/home/himanshu</em>. Please note that a user’s home directory has the same name as their login name. If you are a Windows user, you can think of a Linux home directory as a user specific directory usually present inside <em>C:\Documents and Settings</em> or <em>C:\Users</em>.</p><p></p><p>Users have complete control over their home directory as well as all its sub-directories. This means that they can freely perform operations like create and delete files/directories, install programs, and more, inside their home directory.</p><p></p><p><span style="font-size: 15px"><strong>2. How to check the present working directory?</strong></span></p><p>Whenever you open a command line shell in Linux, you start at your home directory. This is your present working directory, which changes as you switch to some other directory. Use the <em>pwd</em>command to check the complete path of your present working directory at any point of time.</p><p></p><p>Here is an example:</p><p></p><p><img src="http://www.techspot.com/images2/news/bigimage/2014/06/2014-06-17-image-5.png" alt="" class="fr-fic fr-dii fr-draggable " style="" /></p><p></p><p>The <em>pwd</em> command output, shown in the screenshot above, indicates that the user is currently in the<em>Pictures</em> directory, which is inside the <em>himanshu</em> directory, which in turn is a subdirectory of the <em>home</em>directory. In this case <em>himanshu@ubuntu:~/Pictures$</em> is the command line prompt.</p><p></p><p><span style="font-size: 15px"><strong>3. How to switch directories?</strong></span></p><p>Use the <em>cd</em> command to navigate through the Linux filesystem. This command requires either a directory name or its complete path depending upon where the directory is present.</p><p></p><p>For example, if your present working directory is <em>/home/himanshu/pictures</em>, and you want to switch to<em>/home/himanshu/pictures/vacations</em>, then you can simply run the command: <em>cd vacations</em>. In this case, the command line shell will search for the <em>vacations</em> directory inside <em>pictures</em>. A path relative to the present working directory is also known as relative path.</p><p></p><p>But in case you want to switch to <em>/home/techspot</em>, you’ll have to run the command: <em>cd /home/techspot</em>. The complete path, that begins with a forward slash (/), to a directory is also known as its absolute path. To quickly switch to the previous directory in the tree, run: <em>cd ..</em>, or if you want to switch to the previous <em>working</em> directory run <em>cd -</em></p><p></p><p><span style="font-size: 15px"><strong>4. How to view directory contents?</strong></span></p><p>Use the <em>ls</em> command to list the contents of a directory. If the command is run without any argument, it displays the contents of the present working directory.</p><p></p><p>Here is an example:</p><p></p><p><img src="http://www.techspot.com/images2/news/bigimage/2014/06/2014-06-17-image-6.png" alt="" class="fr-fic fr-dii fr-draggable " style="" /></p><p></p><p>To view the contents of any other directory, you can either specify its name (if it’s a subdirectory) or its complete path (if it’s not a subdirectory) as an argument to the <em>ls</em> command.</p><p></p><p>If you observe closely, the output of the <em>ls</em> command is color coded. These different colors represent different types of files, making it easy to visually identify them. Some of the basic colors that you should know are: Blue (Directories), White (Text files), Red (Archives), Cyan (Links), Green(Executables), and Pink (Images).</p><p></p><p><span style="font-size: 15px"><strong>5. How to view the contents of a file?</strong></span></p><p>Use the <em>cat</em> command to view the contents of a file. This command expects a filename as an argument. As you can see in the screenshot below, the <em>cat</em> command displayed the contents of the<em>arg.c</em> file. However, there is a limitation. If the file is large, the output might be too big for the command line shell screen to accommodate.</p><p></p><p><img src="http://www.techspot.com/images2/news/bigimage/2014/06/2014-06-17-image-7.png" alt="" class="fr-fic fr-dii fr-draggable " style="" /></p><p></p><p>In that case you can use use the <em>less</em> command along with the <em>cat</em> command: <em>cat [filename] | less</em>. The<em>|</em> symbol represents a <a href="http://www.linfo.org/pipes.html" target="_blank">pipe</a>, which redirects the output of the <em>cat</em> command to the <em>less</em> command, which in turn makes it possible for you to navigate through the file's content using the arrow keys on your keyboard to scroll up and down. To quit the display mode press the <em>q</em> key.</p><p></p><p><span style="font-size: 15px"><strong>6. How to create a new file?</strong></span></p><p>Use the <em>touch</em> command to create a new file. The command requires a filename as argument. For example, to create a file named <em>test.log</em> in the present working directory, just run the command: <em>touch test.log</em>.</p><p></p><p>To create a new file at a location other than the present working directory, use the absolute path. For example, touch /home/himanshu/practice/test.log.</p><p></p><p><u>Tip</u>: To write anything into a newly created file, use a command line editor like <a href="http://www.ibm.com/developerworks/library/l-lpic1-v3-103-8/" target="_blank">Vi</a> or <a href="http://www.linux.com/learn/tutorials/228600-vim-101-a-beginners-guide-to-vim" target="_blank">Vim</a>.</p><p></p><p><span style="font-size: 15px"><strong>7. How to rename/copy/delete a file?</strong></span></p><p>Use the <em>mv</em> command to rename a file. For example, to rename <em>log.txt</em> to <em>new_log.txt</em>, run the command: <em>mv log.txt new_log.txt</em>. As always, if the file is not present in the present working directory, use the absolute path.</p><p></p><p>You can also use the <em>mv</em> command to move a file from one location to other. This is the equivalent of a cut-paste operation via GUI. For example, to move <em>log.txt</em> (present in current directory) to<em>/home/himanshu</em>, run the command: <em>mv log.txt /home/himanshu</em>.</p><p></p><p>To copy a file from one directory to another, use the <em>cp</em> command. Like the <em>mv</em> command, <em>cp</em> also requires a source and a destination. For example, <em>cp log.txt /home/himanshu</em> would create a copy of<em>log.txt</em> (with the same name) in the <em>/home/himanshu</em> directory.</p><p></p><p>To remove a file, use the <em>rm</em> command. This command expects a filename as an argument. For example, <em>rm log.txt</em> will remove the text file, if present in the current directory, while <em>rm /home/himanshu/practice/log.txt</em> will remove the text file present inside the <em>practice</em> directory.</p><p></p><p>To remove directories, use the <em>-r</em> command line option with the <em>rm</em> command. For example, <em>rm -r /home/himanshu/practice/</em> would delete the <em>practice</em> directory with all its subdirectories and files.</p><p></p><p><span style="font-size: 15px"><strong>8. How to search for files?</strong></span></p><p>To search for files within a given directory, use the <em>find</em> command. The command requires directory path and filename as argument. For example, to search for a file named <em>inheritance.cpp</em> in the<em>/home/himanshu/</em> directory, use the <em>find</em> command in the following way:</p><p></p><p><img src="http://www.techspot.com/images2/news/bigimage/2014/06/2014-06-17-image-8.png" alt="" class="fr-fic fr-dii fr-draggable " style="" /></p><p></p><p>I used <em>sudo</em> in the <em>find</em> command above to remove certain permission errors. You can skip it.</p><p></p><p>If a directory path is not specified, the <em>find</em> command searches in the present working directory.</p><p></p><p>You can also use <a href="http://www.linfo.org/wildcard.html" target="_blank">wildcards</a> with the <em>find</em> command to get the most out of it. For example, if you want to search all <em>.c</em> files present in the <em>/home/himanshu/practice</em> directory, use the <em>find</em> command as shown below. The '*' character is a wildcard that can represent any number of characters. For example, tech* can represent tech, techspot, techreport, and more.</p><p></p><p><img src="http://www.techspot.com/images2/news/bigimage/2014/06/2014-06-17-image-9.png" alt="" class="fr-fic fr-dii fr-draggable " style="" /></p><p></p><p><span style="font-size: 15px"><strong>9. How to search text within files?</strong></span></p><p>To search text within files, use the <em>grep</em> command. The command expects a keyword and a filename as arguments, and outputs lines that contain the keyword. For example, to search all the lines in the file <em>/home/himanshu/practice/wazi/gdb/test.c</em> that contain the keyword <em>ptr</em>, use the grep command in the following way:</p><p></p><p><img src="http://www.techspot.com/images2/news/bigimage/2014/06/2014-06-17-image-10.png" alt="" class="fr-fic fr-dii fr-draggable " style="" /></p><p></p><p>Use the <em>-n</em> command line option in case you want <em>grep</em> to display line numbers in output.</p><p></p><p><img src="http://www.techspot.com/images2/news/bigimage/2014/06/2014-06-17-image-11.png" alt="" class="fr-fic fr-dii fr-draggable " style="" /></p><p></p><p><u>Tip</u>: To search a keyword in all the files present in the current directory, use the <em>*</em> wildcard character as the filename.</p><p></p><p>Please note that unlike the <em>find</em> command, the <em>grep</em> command doesn’t search within subdirectories by default. However, you can enable this functionality by using the <em>-R</em> command line option while running the <em>grep</em> command.</p><p></p><p><span style="font-size: 15px"><strong>10. What is the auto-complete feature?</strong></span></p><p>While working on the Linux command line, typing long paths, file names, and more can feel like a burden. Use the <em>tab</em> key to auto complete these long names and paths easily. For example, to write<em>/home</em>, you can just write <em>/ho</em> and press tab. The command line shell will auto complete the name for you.</p><p></p><p>In the example above, it was easy for the shell to guess the name <em>home</em> because there was no other similar candidate in the / directory. But in case the shell encounters similar names while auto completing, it will display those names and you'll have to write a few more letters for the shell to know the correct name.</p><p></p><p>Here is an example:</p><p></p><p><img src="http://www.techspot.com/images2/news/bigimage/2014/06/2014-06-17-image-12.png" alt="" class="fr-fic fr-dii fr-draggable " style="" /></p><p></p><p>The shell displayed all the names that it can use for auto completion. If, for example, you wanted to write <em>techspot</em>, then you’ll have to type in at least <em>c</em> to resolve the ambiguity. Once done, you can hit the <em>tab</em> key again to autocomplete the name.</p><p></p><p><span style="font-size: 15px"><strong>11. What is root?</strong></span></p><p>Root is the only user that has control over the entire Linux system. It is capable of doing what normal users can’t, such as, changing ownership of files, adding or removing files from system directories, and more. As you can guess, the root account is mostly used by system administrators only.</p><p></p><p>The top level directory in a Linux system, represented by forward slash (/), is known as root directory. It is the same directory that contains the <em>home</em> directory, which further contains user specific directories. However, you shouldn’t confuse / with the root user’s home directory, which is located under / by the name of <em>root</em>.</p><p></p><p><span style="font-size: 15px"><strong>12. What are man pages?</strong></span></p><p>To learn more about Linux commands, you can head over to their respective man (or Manual) pages that come preinstalled with Linux. To open a man page, just run the <em>man</em> command followed by the command name. For example, run <em>man rm</em> to open the manual page of the <em>rm</em> command. You can find a lot of useful information about Linux commands this way.</p><p></p><p><img src="http://www.techspot.com/images2/news/bigimage/2014/06/2014-06-17-image-13.png" alt="" class="fr-fic fr-dii fr-draggable " style="" /></p><p></p><p><span style="font-size: 15px"><strong>13. How to access file metadata like size, permissions, and more?</strong></span></p><p>Use the <em>ls</em> command with <em>-l</em> option to display file metadata in output. For example:</p><p></p><p><img src="http://www.techspot.com/articles-info/844/images/2014-07-04_06-35-12.png" alt="" class="fr-fic fr-dii fr-draggable " style="" /></p><p></p><p>Each line in the output contains metadata information related to a file or a sub-directory present in the current directory. This information can be divided into the following eight parts:</p><p></p><p>+permissions that apply to the owner</p><p>|</p><p>| +permissions that apply to all other users</p><p>| |</p><p>| | +number of <a href="http://www.linfo.org/hard_link.html" target="_blank">hard links</a></p><p>| | |</p><p>| | | +file size +last modification date/time</p><p>_|_ _|_ | _|___ ________|__</p><p>drwxr-xr-x 3 himanshu himanshu 4096 Jul 3 14:26 Desktop</p><p>__ ________ ________ ______</p><p>| | | |</p><p>| | | +name of file/ directory</p><p>| | |</p><p>| | +group the file belongs to</p><p>| |</p><p>| +owner of the file</p><p>|</p><p>+permissions that apply to the members of the group the file belongs to</p><p></p><p>The first character represents the file type. For example, in the line shown above, <em>d</em> indicates this is a directory. Other values can be: <em>-</em> for normal file, <em>s</em> for socket file, <em>l</em> for link file, and more.</p><p></p><p>The next 9 characters represent permissions -- <em>r</em> - read, <em>w</em> - write, <em>x</em>- execute. The first set of three characters represents the owner’s permission, the next three are group's permission, and the final three represent permissions granted to others who are neither the owner, nor the part of the group the file belongs to. In the example shown above, the <em>owner</em> has read, write and execute permissions, while the <em>group</em> as well as <em>others</em> both have only read and execute permissions.</p><p></p><p><u>Tip:</u> Use the <em>-h</em> command line option along with <em>-l</em> to display file size in human readable format.</p><p></p><p><span style="font-size: 15px"><strong>14. How to change file permissions?</strong></span></p><p>Use the <em>chmod</em> command to alter file permissions. There are two ways in which this command can be used. The first method, also known as <em>letters method</em>, uses <em>+</em>, <em>-</em>, and <em>=</em> signs to add, remove, and assign permissions. Letters <em>a</em>, <em>o</em>, <em>u</em>, and <em>g</em> represent all, others, owner, and group respectively.</p><p></p><p>For example, the <em>chmod u=rwx somefile</em> command assigns read, write, and execute permissions to the owner of the file <em>somefile</em>. Similarly, the <em>chmod o+w somefile</em> command adds write permission for others, the <em>chmod g-r somefile</em> removes read permission from the group the file belongs to, and the<em>chmod a+x somefile</em> command adds execute permission for everyone.</p><p></p><p>Specifying <em>a</em> is not mandatory, which means that setting permissions like <em>+x</em> or <em>-r</em> without specifying owner, group or other automatically applies it to all.</p><p></p><p>The second method is the <em>numbers method</em> and it uses <em>4</em>, <em>2</em>, and <em>1</em> instead of <em>r</em>, <em>w</em>, and <em>x</em>. The values are added together in sets of 3 to give us a three digit number denoting permissions.</p><p></p><p>For example, the <em>chmod 761 somefile</em> command gives rwx, rw, and r permissions to the owner, group, and others, respectively. Here <em>7</em> represents the sum of numbers corresponding to r,w, and x. Similarly,<em>6</em> represents the sum of numbers corresponding to r and w, while <em>1</em> represents x.</p><p></p><p><span style="font-size: 15px"><strong>15. How to change file timestamps?</strong></span></p><p>Use the <em>touch</em> command to change file timestamps. There are three types of timestamps associated with a file: <em>Access time</em>, <em>Modification time</em>, and <em>Change time</em>. While the first two are self explanatory, the third one represents the time when the <a href="http://www.linux.org/threads/intro-to-inodes.4130/" target="_blank">inode</a> information or the meta data related to file last changed. Use the <em>stat</em> command to display these timestamps:</p><p></p><p><img src="http://www.techspot.com/articles-info/844/images/2014-07-04_07-29-34.png" alt="" class="fr-fic fr-dii fr-draggable " style="" /></p><p></p><p>To change the file <em>access time</em> to the current time, use the <em>touch</em> command with the <em>-a</em> option: <em>touch -a somefile</em>. Similarly, the <em>-m</em> option changes the file <em>modification time</em> to the current time.</p><p></p><p>To change file timestamps to a time other than the current time, use the <em>-t</em> command line option. For example, the command <em>touch -t 201407020900.01 -a somefile</em> changes the access timestamp of<em>somefile</em> to <em>2014/07/02 09:00:01</em>. You can also pass a specific date and time in human readable form. Use the <em>-d</em> command line option for this. Here are some examples:</p><p></p><p><em>touch -d "2013-01-10 10:00:07" -a somefile</em></p><p></p><p><em>touch -d "next sunday" -m somefile</em></p><p></p><p><em>touch -d "3 hours ago" -a somefile</em></p><p></p><p><span style="font-size: 15px"><strong>16. How to determine file types?</strong></span></p><p>Use the <em>file</em> command to determine file types. As shown in the example below, the command expects a filename as an argument. You can also use the wildcard * in place of file name to display the file type for every file in the current directory: <em>file *</em></p><p></p><p><img src="http://www.techspot.com/articles-info/844/images/2014-07-04_07-45-30.png" alt="" class="fr-fic fr-dii fr-draggable " style="" /></p><p></p><p><span style="font-size: 15px"><strong>17. I’ve downloaded an executable file, but it doesn’t execute, why?</strong></span></p><p>In Linux (and other *nix systems) whether a file is executable or not depends solely on its permissions, not on its extension or content. When a file is downloaded, its original permissions are not known, and is hence given a default set of permissions that are determined by <a href="http://en.wikipedia.org/wiki/Umask" target="_blank">umask</a>.</p><p></p><p>If the user really intends to execute the downloaded file, they’ll have to explicitly give executable permissions to it using the <em>chmod</em> command explained above. Giving permissions manually also helps prevent virus, worms, and more from infecting your system without your knowledge.</p><p></p><p><span style="font-size: 15px"><strong>18. How to print the number of new lines, words, and bytes in files?</strong></span></p><p>Use the <em>wc</em> command to print newline, word, and byte counts for a file. Here is an example:</p><p></p><p><img src="http://www.techspot.com/articles-info/844/images/2014-07-04_07-52-37.png" alt="" class="fr-fic fr-dii fr-draggable " style="" /></p><p></p><p>In the output shown above, <em>5</em> represents the number of lines, <em>12</em> represents the number of words, and<em>52</em> represents the number of bytes. You can also use the <em>-l</em>, <em>-w</em>, and <em>-c</em> command line options to separately produce number of lines, words, and bytes, respectively in the output.</p><p></p><p><span style="font-size: 15px"><strong>19. How to display disk usage of files and directories?</strong></span></p><p>Use the <em>du</em> command to display disk usage of files and directories. Here is an example:</p><p></p><p><img src="http://www.techspot.com/articles-info/844/images/2014-07-04_07-56-49.png" alt="" class="fr-fic fr-dii fr-draggable " style="" /></p><p></p><p><u>Note</u> - The <em>-h</em> command line option is used to produce the size in human readable format.</p><p></p><p>An important thing to note here is that the <em>du</em> command outputs the <em>resident size</em> of a file, which could be different from the <em>actual size</em> that the <em>ls -l</em> command displays. The reason behind this difference is either <a href="http://serverfault.com/questions/290088/what-is-the-difference-between-du-h-and-ls-lh" target="_blank">slack space or sparse files</a>.</p><p></p><p>To display the combined size of a directory as well as all its subdirectories, use the <em>-s</em> option, while <em>-S</em>can be used to display separate sizes. To display the amount of disk space available on the <a href="http://www.linfo.org/filesystem.html" target="_blank">file system</a> containing a specific file or directory use the <em>df</em> command.</p><p></p><p><img src="http://www.techspot.com/articles-info/844/images/2014-07-04_08-02-54.png" alt="" class="fr-fic fr-dii fr-draggable " style="" /></p><p></p><p>Here again, the <em>-h</em> option is used to display the output in human readable format. If the <em>df</em> command is run without any file/directory name, it'll show disk usage for all the file systems.</p><p></p><p><img src="http://www.techspot.com/articles-info/844/images/2014-07-04_08-03-27.png" alt="" class="fr-fic fr-dii fr-draggable " style="" /></p><p></p><p><span style="font-size: 15px"><strong>20. How to compare two files?</strong></span></p><p>Use the <em>diff</em> command to compare two files. The command examines both the files and produces the output in a particular format to let you know what changes are required for the files to match. The command requires two filenames as arguments, as shown in the example below.</p><p></p><p><img src="http://www.techspot.com/articles-info/844/images/2014-07-04_08-11-41.png" alt="" class="fr-fic fr-dii fr-draggable " style="" /></p><p></p><p>Use the <em>diff</em> command to compare these files:</p><p></p><p><img src="http://www.techspot.com/articles-info/844/images/2014-07-04_08-12-27.png" alt="" class="fr-fic fr-dii fr-draggable " style="" /></p><p></p><p>Decrypting the output shown above, <em>5c5</em> means that the fifth line of <em>somefile</em> is changed, and should be replaced by the fifth line of the file <em>anotherfile</em>. The line in question from the first file is marked with a<em><</em> symbol, while line from the second file is marked with a <em>></em> symbol.</p><p></p><p><u>Note</u>- Besides <em>c</em>, which signifies a changed line, the diff command also points which lines need to be added (<em>a</em>) and deleted (<em>d</em>) for the files being compared to match.</p><p></p><p>More complex examples of this command can be found <a href="http://www.linuxdevcenter.com/pub/a/linux/lpt/28_01.html" target="_blank">here</a>.</p><p></p><p><span style="font-size: 15px"><strong>21. How to view the first few and last few lines of a file?</strong></span></p><p>Use the <em>head</em> and <em>tail</em> commands to quickly view the first and last few lines of a file. These commands come in handy when you just want to have a quick peek inside the file. For example, the <em>head -n2 somefile</em> command displays the first <em>2</em> lines of the file <em>somefile</em>. Similarly, the <em>tail -n3 somefile</em> command displays the last <em>3</em> lines of the file.</p><p></p><p>Not only lines, you can also quickly view a specified number of bytes using these commands. For this, use the <em>-c</em> command line option instead of <em>-n</em>. By default, when the number of lines is not specified, both the commands display <em>10</em> lines in the output.</p><p></p><p><span style="font-size: 15px"><strong>22. How to store and view the output of a command at once?</strong></span></p><p>Use the <em>tee</em> command to simultaneously write the output of any other command to standard output as well as to one or more files. For example, the <em>ls | tee ls-dump</em> command displays the output of the <em>ls</em>command on console and stores the output in the file <em>ls-dump</em>.</p><p></p><p>While the <em>tee</em> command is mostly used for capturing and analyzing logs at the same time, it can also be used to speed up your workflow. For example, the <em>echo "Linux command line" | tee file1 > file2</em>command writes the string to both files in one go.</p><p></p><p><span style="font-size: 15px"><strong>23. How to compress and uncompress a file?</strong></span></p><p>Working on Linux requires you to deal with archives like <em>.tar</em>, <em>.tar.gz</em>, <em>.bz2</em>, and more. To create as well as uncompress these archives you can use the <em>tar</em> command.</p><p></p><p>For example, the <em>tar -cvf practice.tar practice/</em> command compresses the <em>practice</em> folder and creates a<em>.tar</em> archive named <em>practice.tar</em>. The <em>-c</em> command line option tells the <em>tar</em> command to create an archive,<em>-v</em> displays the files added to the tarball , and <em>-f</em> specifies the filename.</p><p></p><p>To uncompress the <em>.tar</em> archive created above, use the <em>tar -xvf practice.tar</em> command. The <em>-x</em> command line option signals the command to extract the archive. This command untars the file in the current directory. Use the <em>-C</em> option to specify a different target directory.</p><p></p><p>To create <em>.tar.gz</em> and <em>.tar.bz2</em> archives, add an extra <em>-z</em> and <em>-j</em> command line option, respectively. The command to uncompress these archives is same as the one used for <em>.tar</em> files. Use the <em>-t</em> command line option (along with <em>v</em> and <em>f</em>) in case you just want to list the contents of an archive.</p><p></p><p><u>Tip</u> - To deal with <em>.zip</em> files, use the <a href="http://www.slashroot.in/linux-zip-command-examples-compressing-and-decompressing-files-securely" target="_blank"><em>zip</em></a> command.</p><p></p><p><span style="font-size: 15px"><strong>24. How to edit a file using Vim editor?</strong></span></p><p>While the Vim editor is one of the most powerful command line text editors, it also requires you to learn a lot of keyboard shortcuts. But the basics of editing are simple and easy.</p><p></p><p>To open a file in the editor, run the <em>vim </em>command with the file name as an argument. For example, <em>vim textfile</em>. If the file <em>textfile</em> doesn’t exist in the specified directory, the editor will create and open a new file by that name, otherwise it will open the existing file.</p><p></p><p>There are two operation modes in Vim: <em>command mode</em> and <em>insert mode</em>. The editor opens the file in command mode, where you can move the cursor using the arrow keys on your keyboard, but cannot edit the file until you press <em>i</em> -- activating the insert mode as shown below.</p><p></p><p><img src="http://www.techspot.com/articles-info/844/images/2014-07-04_08-44-02.png" alt="" class="fr-fic fr-dii fr-draggable " style="" /></p><p></p><p>Once you are done editing the file, you have to press the <em>Esc</em> key to come out of the insert mode and into the command mode before being able to save the file.</p><p></p><p><img src="http://www.techspot.com/articles-info/844/images/2014-07-04_08-45-49.png" alt="" class="fr-fic fr-dii fr-draggable " style="" /></p><p></p><p>To save the file, type the <em>:w</em> command and then hit <em>Enter</em>.</p><p></p><p><img src="http://www.techspot.com/articles-info/844/images/2014-07-04_08-48-29.png" alt="" class="fr-fic fr-dii fr-draggable " style="" /></p><p></p><p>To quit the editor, type the <em>:q</em> command and press Enter, or <em>:wq</em> to save and quit in one go.</p><p></p><p style="margin-left: 20px"><u><strong>Note</strong></u> - To quickly copy or delete a line, switch the editor to the <em>command mode</em>, bring the cursor to the desired line, and type <em><strong>yy </strong></em>or<em><strong> dd</strong></em>, respectively. To paste, press <em><strong>p</strong></em> in the command mode.</p> <p style="margin-left: 20px"><a href="http://www.techspot.com/guides/835-linux-command-line-basics/" target="_blank"><span style="font-size: 12px">From TechSpot</span></a></p></blockquote><p></p>
[QUOTE="BoraMurdar, post: 227416, member: 2291"] [SIZE=4][B]1. What is a home directory in Linux?[/B][/SIZE] Linux is a multi-user operating system, which means that more than one user can access the OS at the same time. To make things easy, each user is assigned a directory where they can store their personal files. This directory is known as a user's home directory. Home directories are found under the [I]home[/I] directory. For example, my home directory is[I]/home/himanshu[/I]. Please note that a user’s home directory has the same name as their login name. If you are a Windows user, you can think of a Linux home directory as a user specific directory usually present inside [I]C:\Documents and Settings[/I] or [I]C:\Users[/I]. Users have complete control over their home directory as well as all its sub-directories. This means that they can freely perform operations like create and delete files/directories, install programs, and more, inside their home directory. [SIZE=4][B]2. How to check the present working directory?[/B][/SIZE] Whenever you open a command line shell in Linux, you start at your home directory. This is your present working directory, which changes as you switch to some other directory. Use the [I]pwd[/I]command to check the complete path of your present working directory at any point of time. Here is an example: [IMG]http://www.techspot.com/images2/news/bigimage/2014/06/2014-06-17-image-5.png[/IMG] The [I]pwd[/I] command output, shown in the screenshot above, indicates that the user is currently in the[I]Pictures[/I] directory, which is inside the [I]himanshu[/I] directory, which in turn is a subdirectory of the [I]home[/I]directory. In this case [I]himanshu@ubuntu:~/Pictures$[/I] is the command line prompt. [SIZE=4][B]3. How to switch directories?[/B][/SIZE] Use the [I]cd[/I] command to navigate through the Linux filesystem. This command requires either a directory name or its complete path depending upon where the directory is present. For example, if your present working directory is [I]/home/himanshu/pictures[/I], and you want to switch to[I]/home/himanshu/pictures/vacations[/I], then you can simply run the command: [I]cd vacations[/I]. In this case, the command line shell will search for the [I]vacations[/I] directory inside [I]pictures[/I]. A path relative to the present working directory is also known as relative path. But in case you want to switch to [I]/home/techspot[/I], you’ll have to run the command: [I]cd /home/techspot[/I]. The complete path, that begins with a forward slash (/), to a directory is also known as its absolute path. To quickly switch to the previous directory in the tree, run: [I]cd ..[/I], or if you want to switch to the previous [I]working[/I] directory run [I]cd -[/I] [SIZE=4][B]4. How to view directory contents?[/B][/SIZE] Use the [I]ls[/I] command to list the contents of a directory. If the command is run without any argument, it displays the contents of the present working directory. Here is an example: [IMG]http://www.techspot.com/images2/news/bigimage/2014/06/2014-06-17-image-6.png[/IMG] To view the contents of any other directory, you can either specify its name (if it’s a subdirectory) or its complete path (if it’s not a subdirectory) as an argument to the [I]ls[/I] command. If you observe closely, the output of the [I]ls[/I] command is color coded. These different colors represent different types of files, making it easy to visually identify them. Some of the basic colors that you should know are: Blue (Directories), White (Text files), Red (Archives), Cyan (Links), Green(Executables), and Pink (Images). [SIZE=4][B]5. How to view the contents of a file?[/B][/SIZE] Use the [I]cat[/I] command to view the contents of a file. This command expects a filename as an argument. As you can see in the screenshot below, the [I]cat[/I] command displayed the contents of the[I]arg.c[/I] file. However, there is a limitation. If the file is large, the output might be too big for the command line shell screen to accommodate. [IMG]http://www.techspot.com/images2/news/bigimage/2014/06/2014-06-17-image-7.png[/IMG] In that case you can use use the [I]less[/I] command along with the [I]cat[/I] command: [I]cat [filename] | less[/I]. The[I]|[/I] symbol represents a [URL='http://www.linfo.org/pipes.html']pipe[/URL], which redirects the output of the [I]cat[/I] command to the [I]less[/I] command, which in turn makes it possible for you to navigate through the file's content using the arrow keys on your keyboard to scroll up and down. To quit the display mode press the [I]q[/I] key. [SIZE=4][B]6. How to create a new file?[/B][/SIZE] Use the [I]touch[/I] command to create a new file. The command requires a filename as argument. For example, to create a file named [I]test.log[/I] in the present working directory, just run the command: [I]touch test.log[/I]. To create a new file at a location other than the present working directory, use the absolute path. For example, touch /home/himanshu/practice/test.log. [U]Tip[/U]: To write anything into a newly created file, use a command line editor like [URL='http://www.ibm.com/developerworks/library/l-lpic1-v3-103-8/']Vi[/URL] or [URL='http://www.linux.com/learn/tutorials/228600-vim-101-a-beginners-guide-to-vim']Vim[/URL]. [SIZE=4][B]7. How to rename/copy/delete a file?[/B][/SIZE] Use the [I]mv[/I] command to rename a file. For example, to rename [I]log.txt[/I] to [I]new_log.txt[/I], run the command: [I]mv log.txt new_log.txt[/I]. As always, if the file is not present in the present working directory, use the absolute path. You can also use the [I]mv[/I] command to move a file from one location to other. This is the equivalent of a cut-paste operation via GUI. For example, to move [I]log.txt[/I] (present in current directory) to[I]/home/himanshu[/I], run the command: [I]mv log.txt /home/himanshu[/I]. To copy a file from one directory to another, use the [I]cp[/I] command. Like the [I]mv[/I] command, [I]cp[/I] also requires a source and a destination. For example, [I]cp log.txt /home/himanshu[/I] would create a copy of[I]log.txt[/I] (with the same name) in the [I]/home/himanshu[/I] directory. To remove a file, use the [I]rm[/I] command. This command expects a filename as an argument. For example, [I]rm log.txt[/I] will remove the text file, if present in the current directory, while [I]rm /home/himanshu/practice/log.txt[/I] will remove the text file present inside the [I]practice[/I] directory. To remove directories, use the [I]-r[/I] command line option with the [I]rm[/I] command. For example, [I]rm -r /home/himanshu/practice/[/I] would delete the [I]practice[/I] directory with all its subdirectories and files. [SIZE=4][B]8. How to search for files?[/B][/SIZE] To search for files within a given directory, use the [I]find[/I] command. The command requires directory path and filename as argument. For example, to search for a file named [I]inheritance.cpp[/I] in the[I]/home/himanshu/[/I] directory, use the [I]find[/I] command in the following way: [IMG]http://www.techspot.com/images2/news/bigimage/2014/06/2014-06-17-image-8.png[/IMG] I used [I]sudo[/I] in the [I]find[/I] command above to remove certain permission errors. You can skip it. If a directory path is not specified, the [I]find[/I] command searches in the present working directory. You can also use [URL='http://www.linfo.org/wildcard.html']wildcards[/URL] with the [I]find[/I] command to get the most out of it. For example, if you want to search all [I].c[/I] files present in the [I]/home/himanshu/practice[/I] directory, use the [I]find[/I] command as shown below. The '*' character is a wildcard that can represent any number of characters. For example, tech* can represent tech, techspot, techreport, and more. [IMG]http://www.techspot.com/images2/news/bigimage/2014/06/2014-06-17-image-9.png[/IMG] [SIZE=4][B]9. How to search text within files?[/B][/SIZE] To search text within files, use the [I]grep[/I] command. The command expects a keyword and a filename as arguments, and outputs lines that contain the keyword. For example, to search all the lines in the file [I]/home/himanshu/practice/wazi/gdb/test.c[/I] that contain the keyword [I]ptr[/I], use the grep command in the following way: [IMG]http://www.techspot.com/images2/news/bigimage/2014/06/2014-06-17-image-10.png[/IMG] Use the [I]-n[/I] command line option in case you want [I]grep[/I] to display line numbers in output. [IMG]http://www.techspot.com/images2/news/bigimage/2014/06/2014-06-17-image-11.png[/IMG] [U]Tip[/U]: To search a keyword in all the files present in the current directory, use the [I]*[/I] wildcard character as the filename. Please note that unlike the [I]find[/I] command, the [I]grep[/I] command doesn’t search within subdirectories by default. However, you can enable this functionality by using the [I]-R[/I] command line option while running the [I]grep[/I] command. [SIZE=4][B]10. What is the auto-complete feature?[/B][/SIZE] While working on the Linux command line, typing long paths, file names, and more can feel like a burden. Use the [I]tab[/I] key to auto complete these long names and paths easily. For example, to write[I]/home[/I], you can just write [I]/ho[/I] and press tab. The command line shell will auto complete the name for you. In the example above, it was easy for the shell to guess the name [I]home[/I] because there was no other similar candidate in the / directory. But in case the shell encounters similar names while auto completing, it will display those names and you'll have to write a few more letters for the shell to know the correct name. Here is an example: [IMG]http://www.techspot.com/images2/news/bigimage/2014/06/2014-06-17-image-12.png[/IMG] The shell displayed all the names that it can use for auto completion. If, for example, you wanted to write [I]techspot[/I], then you’ll have to type in at least [I]c[/I] to resolve the ambiguity. Once done, you can hit the [I]tab[/I] key again to autocomplete the name. [SIZE=4][B]11. What is root?[/B][/SIZE] Root is the only user that has control over the entire Linux system. It is capable of doing what normal users can’t, such as, changing ownership of files, adding or removing files from system directories, and more. As you can guess, the root account is mostly used by system administrators only. The top level directory in a Linux system, represented by forward slash (/), is known as root directory. It is the same directory that contains the [I]home[/I] directory, which further contains user specific directories. However, you shouldn’t confuse / with the root user’s home directory, which is located under / by the name of [I]root[/I]. [SIZE=4][B]12. What are man pages?[/B][/SIZE] To learn more about Linux commands, you can head over to their respective man (or Manual) pages that come preinstalled with Linux. To open a man page, just run the [I]man[/I] command followed by the command name. For example, run [I]man rm[/I] to open the manual page of the [I]rm[/I] command. You can find a lot of useful information about Linux commands this way. [IMG]http://www.techspot.com/images2/news/bigimage/2014/06/2014-06-17-image-13.png[/IMG] [SIZE=4][B]13. How to access file metadata like size, permissions, and more?[/B][/SIZE] Use the [I]ls[/I] command with [I]-l[/I] option to display file metadata in output. For example: [IMG]http://www.techspot.com/articles-info/844/images/2014-07-04_06-35-12.png[/IMG] Each line in the output contains metadata information related to a file or a sub-directory present in the current directory. This information can be divided into the following eight parts: +permissions that apply to the owner | | +permissions that apply to all other users | | | | +number of [URL='http://www.linfo.org/hard_link.html']hard links[/URL] | | | | | | +file size +last modification date/time _|_ _|_ | _|___ ________|__ drwxr-xr-x 3 himanshu himanshu 4096 Jul 3 14:26 Desktop __ ________ ________ ______ | | | | | | | +name of file/ directory | | | | | +group the file belongs to | | | +owner of the file | +permissions that apply to the members of the group the file belongs to The first character represents the file type. For example, in the line shown above, [I]d[/I] indicates this is a directory. Other values can be: [I]-[/I] for normal file, [I]s[/I] for socket file, [I]l[/I] for link file, and more. The next 9 characters represent permissions -- [I]r[/I] - read, [I]w[/I] - write, [I]x[/I]- execute. The first set of three characters represents the owner’s permission, the next three are group's permission, and the final three represent permissions granted to others who are neither the owner, nor the part of the group the file belongs to. In the example shown above, the [I]owner[/I] has read, write and execute permissions, while the [I]group[/I] as well as [I]others[/I] both have only read and execute permissions. [U]Tip:[/U] Use the [I]-h[/I] command line option along with [I]-l[/I] to display file size in human readable format. [SIZE=4][B]14. How to change file permissions?[/B][/SIZE] Use the [I]chmod[/I] command to alter file permissions. There are two ways in which this command can be used. The first method, also known as [I]letters method[/I], uses [I]+[/I], [I]-[/I], and [I]=[/I] signs to add, remove, and assign permissions. Letters [I]a[/I], [I]o[/I], [I]u[/I], and [I]g[/I] represent all, others, owner, and group respectively. For example, the [I]chmod u=rwx somefile[/I] command assigns read, write, and execute permissions to the owner of the file [I]somefile[/I]. Similarly, the [I]chmod o+w somefile[/I] command adds write permission for others, the [I]chmod g-r somefile[/I] removes read permission from the group the file belongs to, and the[I]chmod a+x somefile[/I] command adds execute permission for everyone. Specifying [I]a[/I] is not mandatory, which means that setting permissions like [I]+x[/I] or [I]-r[/I] without specifying owner, group or other automatically applies it to all. The second method is the [I]numbers method[/I] and it uses [I]4[/I], [I]2[/I], and [I]1[/I] instead of [I]r[/I], [I]w[/I], and [I]x[/I]. The values are added together in sets of 3 to give us a three digit number denoting permissions. For example, the [I]chmod 761 somefile[/I] command gives rwx, rw, and r permissions to the owner, group, and others, respectively. Here [I]7[/I] represents the sum of numbers corresponding to r,w, and x. Similarly,[I]6[/I] represents the sum of numbers corresponding to r and w, while [I]1[/I] represents x. [SIZE=4][B]15. How to change file timestamps?[/B][/SIZE] Use the [I]touch[/I] command to change file timestamps. There are three types of timestamps associated with a file: [I]Access time[/I], [I]Modification time[/I], and [I]Change time[/I]. While the first two are self explanatory, the third one represents the time when the [URL='http://www.linux.org/threads/intro-to-inodes.4130/']inode[/URL] information or the meta data related to file last changed. Use the [I]stat[/I] command to display these timestamps: [IMG]http://www.techspot.com/articles-info/844/images/2014-07-04_07-29-34.png[/IMG] To change the file [I]access time[/I] to the current time, use the [I]touch[/I] command with the [I]-a[/I] option: [I]touch -a somefile[/I]. Similarly, the [I]-m[/I] option changes the file [I]modification time[/I] to the current time. To change file timestamps to a time other than the current time, use the [I]-t[/I] command line option. For example, the command [I]touch -t 201407020900.01 -a somefile[/I] changes the access timestamp of[I]somefile[/I] to [I]2014/07/02 09:00:01[/I]. You can also pass a specific date and time in human readable form. Use the [I]-d[/I] command line option for this. Here are some examples: [I]touch -d "2013-01-10 10:00:07" -a somefile[/I] [I]touch -d "next sunday" -m somefile[/I] [I]touch -d "3 hours ago" -a somefile[/I] [SIZE=4][B]16. How to determine file types?[/B][/SIZE] Use the [I]file[/I] command to determine file types. As shown in the example below, the command expects a filename as an argument. You can also use the wildcard * in place of file name to display the file type for every file in the current directory: [I]file *[/I] [IMG]http://www.techspot.com/articles-info/844/images/2014-07-04_07-45-30.png[/IMG] [SIZE=4][B]17. I’ve downloaded an executable file, but it doesn’t execute, why?[/B][/SIZE] In Linux (and other *nix systems) whether a file is executable or not depends solely on its permissions, not on its extension or content. When a file is downloaded, its original permissions are not known, and is hence given a default set of permissions that are determined by [URL='http://en.wikipedia.org/wiki/Umask']umask[/URL]. If the user really intends to execute the downloaded file, they’ll have to explicitly give executable permissions to it using the [I]chmod[/I] command explained above. Giving permissions manually also helps prevent virus, worms, and more from infecting your system without your knowledge. [SIZE=4][B]18. How to print the number of new lines, words, and bytes in files?[/B][/SIZE] Use the [I]wc[/I] command to print newline, word, and byte counts for a file. Here is an example: [IMG]http://www.techspot.com/articles-info/844/images/2014-07-04_07-52-37.png[/IMG] In the output shown above, [I]5[/I] represents the number of lines, [I]12[/I] represents the number of words, and[I]52[/I] represents the number of bytes. You can also use the [I]-l[/I], [I]-w[/I], and [I]-c[/I] command line options to separately produce number of lines, words, and bytes, respectively in the output. [SIZE=4][B]19. How to display disk usage of files and directories?[/B][/SIZE] Use the [I]du[/I] command to display disk usage of files and directories. Here is an example: [IMG]http://www.techspot.com/articles-info/844/images/2014-07-04_07-56-49.png[/IMG] [U]Note[/U] - The [I]-h[/I] command line option is used to produce the size in human readable format. An important thing to note here is that the [I]du[/I] command outputs the [I]resident size[/I] of a file, which could be different from the [I]actual size[/I] that the [I]ls -l[/I] command displays. The reason behind this difference is either [URL='http://serverfault.com/questions/290088/what-is-the-difference-between-du-h-and-ls-lh']slack space or sparse files[/URL]. To display the combined size of a directory as well as all its subdirectories, use the [I]-s[/I] option, while [I]-S[/I]can be used to display separate sizes. To display the amount of disk space available on the [URL='http://www.linfo.org/filesystem.html']file system[/URL] containing a specific file or directory use the [I]df[/I] command. [IMG]http://www.techspot.com/articles-info/844/images/2014-07-04_08-02-54.png[/IMG] Here again, the [I]-h[/I] option is used to display the output in human readable format. If the [I]df[/I] command is run without any file/directory name, it'll show disk usage for all the file systems. [IMG]http://www.techspot.com/articles-info/844/images/2014-07-04_08-03-27.png[/IMG] [SIZE=4][B]20. How to compare two files?[/B][/SIZE] Use the [I]diff[/I] command to compare two files. The command examines both the files and produces the output in a particular format to let you know what changes are required for the files to match. The command requires two filenames as arguments, as shown in the example below. [IMG]http://www.techspot.com/articles-info/844/images/2014-07-04_08-11-41.png[/IMG] Use the [I]diff[/I] command to compare these files: [IMG]http://www.techspot.com/articles-info/844/images/2014-07-04_08-12-27.png[/IMG] Decrypting the output shown above, [I]5c5[/I] means that the fifth line of [I]somefile[/I] is changed, and should be replaced by the fifth line of the file [I]anotherfile[/I]. The line in question from the first file is marked with a[I]<[/I] symbol, while line from the second file is marked with a [I]>[/I] symbol. [U]Note[/U]- Besides [I]c[/I], which signifies a changed line, the diff command also points which lines need to be added ([I]a[/I]) and deleted ([I]d[/I]) for the files being compared to match. More complex examples of this command can be found [URL='http://www.linuxdevcenter.com/pub/a/linux/lpt/28_01.html']here[/URL]. [SIZE=4][B]21. How to view the first few and last few lines of a file?[/B][/SIZE] Use the [I]head[/I] and [I]tail[/I] commands to quickly view the first and last few lines of a file. These commands come in handy when you just want to have a quick peek inside the file. For example, the [I]head -n2 somefile[/I] command displays the first [I]2[/I] lines of the file [I]somefile[/I]. Similarly, the [I]tail -n3 somefile[/I] command displays the last [I]3[/I] lines of the file. Not only lines, you can also quickly view a specified number of bytes using these commands. For this, use the [I]-c[/I] command line option instead of [I]-n[/I]. By default, when the number of lines is not specified, both the commands display [I]10[/I] lines in the output. [SIZE=4][B]22. How to store and view the output of a command at once?[/B][/SIZE] Use the [I]tee[/I] command to simultaneously write the output of any other command to standard output as well as to one or more files. For example, the [I]ls | tee ls-dump[/I] command displays the output of the [I]ls[/I]command on console and stores the output in the file [I]ls-dump[/I]. While the [I]tee[/I] command is mostly used for capturing and analyzing logs at the same time, it can also be used to speed up your workflow. For example, the [I]echo "Linux command line" | tee file1 > file2[/I]command writes the string to both files in one go. [SIZE=4][B]23. How to compress and uncompress a file?[/B][/SIZE] Working on Linux requires you to deal with archives like [I].tar[/I], [I].tar.gz[/I], [I].bz2[/I], and more. To create as well as uncompress these archives you can use the [I]tar[/I] command. For example, the [I]tar -cvf practice.tar practice/[/I] command compresses the [I]practice[/I] folder and creates a[I].tar[/I] archive named [I]practice.tar[/I]. The [I]-c[/I] command line option tells the [I]tar[/I] command to create an archive,[I]-v[/I] displays the files added to the tarball , and [I]-f[/I] specifies the filename. To uncompress the [I].tar[/I] archive created above, use the [I]tar -xvf practice.tar[/I] command. The [I]-x[/I] command line option signals the command to extract the archive. This command untars the file in the current directory. Use the [I]-C[/I] option to specify a different target directory. To create [I].tar.gz[/I] and [I].tar.bz2[/I] archives, add an extra [I]-z[/I] and [I]-j[/I] command line option, respectively. The command to uncompress these archives is same as the one used for [I].tar[/I] files. Use the [I]-t[/I] command line option (along with [I]v[/I] and [I]f[/I]) in case you just want to list the contents of an archive. [U]Tip[/U] - To deal with [I].zip[/I] files, use the [URL='http://www.slashroot.in/linux-zip-command-examples-compressing-and-decompressing-files-securely'][I]zip[/I][/URL] command. [SIZE=4][B]24. How to edit a file using Vim editor?[/B][/SIZE] While the Vim editor is one of the most powerful command line text editors, it also requires you to learn a lot of keyboard shortcuts. But the basics of editing are simple and easy. To open a file in the editor, run the [I]vim [/I]command with the file name as an argument. For example, [I]vim textfile[/I]. If the file [I]textfile[/I] doesn’t exist in the specified directory, the editor will create and open a new file by that name, otherwise it will open the existing file. There are two operation modes in Vim: [I]command mode[/I] and [I]insert mode[/I]. The editor opens the file in command mode, where you can move the cursor using the arrow keys on your keyboard, but cannot edit the file until you press [I]i[/I] -- activating the insert mode as shown below. [IMG]http://www.techspot.com/articles-info/844/images/2014-07-04_08-44-02.png[/IMG] Once you are done editing the file, you have to press the [I]Esc[/I] key to come out of the insert mode and into the command mode before being able to save the file. [IMG]http://www.techspot.com/articles-info/844/images/2014-07-04_08-45-49.png[/IMG] To save the file, type the [I]:w[/I] command and then hit [I]Enter[/I]. [IMG]http://www.techspot.com/articles-info/844/images/2014-07-04_08-48-29.png[/IMG] To quit the editor, type the [I]:q[/I] command and press Enter, or [I]:wq[/I] to save and quit in one go. [INDENT][U][B]Note[/B][/U] - To quickly copy or delete a line, switch the editor to the [I]command mode[/I], bring the cursor to the desired line, and type [I][B]yy [/B][/I]or[I][B] dd[/B][/I], respectively. To paste, press [I][B]p[/B][/I] in the command mode. [URL='http://www.techspot.com/guides/835-linux-command-line-basics/'][SIZE=3]From TechSpot[/SIZE][/URL][/INDENT] [/QUOTE]
Insert quotes…
Verification
Post reply
Top