|
| 1 | +# The 10 Most Important Linux Commands |
| 2 | + |
| 3 | +Credit: Brad Yale |
| 4 | + |
| 5 | + |
| 6 | +## 1. ls |
| 7 | + |
| 8 | +The ls command - the list command - functions in the [Linux |
| 9 | +terminal](http://www.informit.com/store/linux-kernel-development-9780672329463) |
| 10 | +to show all of the major directories filed under a given file system. |
| 11 | +For example, the command: |
| 12 | + |
| 13 | +**ls /applications** |
| 14 | + |
| 15 | +...will show the user all of the folders stored in the overall |
| 16 | +applications folder. |
| 17 | + |
| 18 | +The ls command is used for viewing files, folders and directories. |
| 19 | + |
| 20 | +## 2. cd |
| 21 | + |
| 22 | +The cd command - change directory - will allow the user to change |
| 23 | +between file directories. As the name command name suggest, you would |
| 24 | +use the cd command to circulate between two different directories. For |
| 25 | +example, if you wanted to change from the home directory to the Arora |
| 26 | +directory, you would input the following command: |
| 27 | + |
| 28 | +**cd/arora/applications** |
| 29 | + |
| 30 | +As you might have noted, the path name listed lists in reverse order. |
| 31 | +Logically **cd/arora/applications** reads change to the arora directory |
| 32 | +which is stored in the applications directory. All Linux commands follow |
| 33 | +a logical path. |
| 34 | + |
| 35 | +## 3. mv |
| 36 | + |
| 37 | +The mv command - move - allows a user to move a file to another folder |
| 38 | +or directory. Just like dragging a file located on a PC desktop to a |
| 39 | +folder stored within the "Documents" folder, the mv command functions in |
| 40 | +the same manner. An example of the mv command is: |
| 41 | + |
| 42 | +**mv/arora/applications/majorapps /arora/applications/minorapps** |
| 43 | + |
| 44 | + |
| 45 | +The first part of the command **mv/arora/applications/majorapps** lists |
| 46 | +the application to be moved. In this case, arora. The second part of the |
| 47 | +command **/arora/applications/minorapps** lists where arora will be |
| 48 | +moved to - from majorapps to minorapps. |
| 49 | + |
| 50 | +## 4. man |
| 51 | +- |
| 52 | +The man command - the manual command - is used to show the manual of the |
| 53 | +inputted command. Just like a film on the nature of film, the man |
| 54 | +command is the meta command of the [Linux |
| 55 | +CLI](http://www.informit.com/articles/article.aspx?p=1339466). Inputting |
| 56 | +the man command will show you all information about the command you are |
| 57 | +using. An example: |
| 58 | + |
| 59 | +**man cd** |
| 60 | + |
| 61 | +The inputting command will show the manual or all relevant information |
| 62 | +for the change directory command. |
| 63 | + |
| 64 | +## 5. mkdir |
| 65 | +--- |
| 66 | +The mkdir - make directory - command allows the user to make a new |
| 67 | +directory. Just like making a new directory within a PC or Mac desktop |
| 68 | +environment, the mkdir command makes new directories in a Linux |
| 69 | +environment. An example of the mkdir command |
| 70 | + |
| 71 | +**mkdir testdirectory** |
| 72 | + |
| 73 | +The example command made the directory "testdirectory". |
| 74 | + |
| 75 | +## 6. rmdir |
| 76 | +--- |
| 77 | +The rmdir - remove directory - command allows the user to remove an |
| 78 | +existing command using the Linux CLI. An example of the rmdir command: |
| 79 | + |
| 80 | +**rmdir testdirectory** |
| 81 | + |
| 82 | + |
| 83 | +The example command removed the directory "testdirectory". |
| 84 | + |
| 85 | +**It should be noted: both the mkdir and rmdir commands make and remove |
| 86 | +directories. They do not make files and they will also not remove a |
| 87 | +directory which has files in it. The mkdir will make an empty directory |
| 88 | +and the rmdir command will remove an empty directory.** |
| 89 | + |
| 90 | +**** |
| 91 | + |
| 92 | +{width="650" |
| 93 | +height="400"}**** |
| 94 | + |
| 95 | +## 7. touch |
| 96 | +--- |
| 97 | +The touch command - a.k.a. the make file command - allows users to make |
| 98 | +files using the Linux CLI. Just as the mkdir command makes directories, |
| 99 | +the touch command makes files. Just as you would make a .doc or a .txt |
| 100 | +using a PC desktop, the touch command makes empty files. An example of |
| 101 | +the touch command: |
| 102 | + |
| 103 | +**touch testfile.txt** |
| 104 | + |
| 105 | +The example touch command effectively created the file testfile.txt. As |
| 106 | +noted by the extension, the file created is a .txt or text file. To |
| 107 | +equate, a .txt file in Linux is akin to a .txt notebook file within a |
| 108 | +Windows or Mac OS. |
| 109 | + |
| 110 | +## 8. rm |
| 111 | + |
| 112 | +The rm command - remove - like the rmdir command is meant to remove |
| 113 | +files from your Linux OS. Whereas the rmdir command will remove |
| 114 | +directories and files held within, the rm command will delete created |
| 115 | +files. An example of the rm command: |
| 116 | + |
| 117 | +**rm testfile.txt** |
| 118 | + |
| 119 | +The aforementioned command removed testfile.txt. Interestingly, whereas |
| 120 | +the rmdir command will only delete an empty directory, the rm command |
| 121 | +will remove both files and directories with files in it. This said, the |
| 122 | +rm command carries more weight than the rmdir command and should be used |
| 123 | +with more specificity. |
| 124 | + |
| 125 | +## 9. locate |
| 126 | +---- |
| 127 | +The locate - a.k.a. find - command is meant to find a file within the |
| 128 | +Linux OS. If you don't know the name of a certain file or you aren't |
| 129 | +sure where the file is saved and stored, the locate command comes in |
| 130 | +handy. A locate command example: |
| 131 | + |
| 132 | +**locate -i \*red\*house\*\*city\*** |
| 133 | + |
| 134 | +The stated command will locate an file with the a file name containing |
| 135 | +"Red", "House" and "City". A note on the input: the use of "-i" tells |
| 136 | +the system to search for a file unspecific of capitalization (Linux |
| 137 | +functions in lower case). The use of the asterik "\*" signifies |
| 138 | +searching for a wildcard. A wildcard tells the system to pull any and |
| 139 | +all files containing the search criteria. |
| 140 | + |
| 141 | +By specifying -i with wildcards, the locate CLI command will pull back |
| 142 | +all files containing your search criteria effectivley casting the widest |
| 143 | +search net the system will allow. |
| 144 | + |
| 145 | +## 10. clear |
| 146 | + |
| 147 | +The clear command does exactly what it says. When your Linux CLI gets |
| 148 | +all mucked up with various readouts and information, the clear command |
| 149 | +clears the screen and wipes the board clean. Using the clear command |
| 150 | +will take the user back to the start prompt of whatever directory you |
| 151 | +are currently operating in. To use the clear command simply type |
| 152 | +**clear**. |
| 153 | + |
| 154 | +# Getting to Know Linux: Vital Information |
| 155 | + |
| 156 | +Having a basic understanding on Linux CLI commands will allow any user |
| 157 | +to navigate around the Linux shell. This said, there are some basic |
| 158 | +things about Linux you need to know to more fully operate in the shell. |
| 159 | +These basics are as follows: |
| 160 | + |
| 161 | +- **All Linux operating systems function in lower case**. The basic idea |
| 162 | +of Linux is to utilize a simple easy to use operating system. The use of |
| 163 | +lower case comes out of this. While you can name files, folders and |
| 164 | +directories using upper case, the system functions in lower case. This |
| 165 | +means unless you specify -i (negate case lock), all files, folders and |
| 166 | +directories named with an upper case will not be shown. Thus, the |
| 167 | +command |
| 168 | + |
| 169 | +**locate thekillersadustlandfairytale.mp3** |
| 170 | + |
| 171 | +Will not locate the file TheKillersADustLandFairyTale.mp3 |
| 172 | + |
| 173 | +In Linux, upper and lower case matter. |
| 174 | + |
| 175 | +- **Be very careful using the rm command**. The rm command, as noted |
| 176 | +above, carries more weight than the rmdir command. Using the rm command |
| 177 | +can wipe out entire directories full of files. Be careful using it. |
| 178 | +Moreover, if a buddy jokingly tells you to input the command: |
| 179 | + |
| 180 | +**rm -rf/** |
| 181 | + |
| 182 | +Do not do it. The rm -rf/ command means remove (rm) - recursive (r) |
| 183 | +force (f) home (/). Spelled out logically, the rm -rf/ command will |
| 184 | +delete every folder, file and directory within your Linux OS. It is the |
| 185 | +equivalent of wiping your entire hard drive clean. Use the rm-rf/ |
| 186 | +command at your own peril. |
| 187 | + |
| 188 | +- **/ means root**. For the vast majority of PC's the home prompt in the |
| 189 | +Command Prompt (CMD) is some variation on: |
| 190 | + |
| 191 | +The PC user in command prompt will start from the C:\\ hard drive. In |
| 192 | +Linux your CLI starting point - your root directory - is /. / represents |
| 193 | +your starting point. / is where all other files, folders and directories |
| 194 | +are stored within. |
| 195 | + |
| 196 | +- **Passwords are kept in the dark**. The first time I logged into a |
| 197 | +Linux server, I instantly became confused when prompted for my password. |
| 198 | +This is because when you type in your password into the Linux CLI, the |
| 199 | +password is kept dark. While typing, you will see nothing. The Linux CLI |
| 200 | +operates with the assumption that the user typing in the password knows |
| 201 | +what he/she is typing and thus, for security reasons, has no need to |
| 202 | +view it while it is input. |
| 203 | + |
| 204 | +Don't freak out when you do not see your password or little asterisks |
| 205 | +to hide your input. The Linux system is recording every key tap. |
| 206 | + |
| 207 | +- **Master Linux foundations before advancing**. Just like learning new |
| 208 | +branches of Mathematics, to build higher, your foundation must be |
| 209 | +strong. Linux operates in the same fashion. If you do not master Linux |
| 210 | +basics, you will quickly become confused when trying to complete complex |
| 211 | +tasks and will, like many first time users do, become frustrated and |
| 212 | +quit. To write a new script, to install a script or to install a basic |
| 213 | +word editor, you first must know how to move between directories, how to |
| 214 | +copy (cp command) files and how to make/remove files and directories. |
| 215 | + |
| 216 | +Before you move to more advanced Linux tasks, master the basics. |
| 217 | + |
| 218 | +- **Remember, Linux Web Operations are free**. Maybe the best thing |
| 219 | +about Linux is that it an open source platform meaning the operating |
| 220 | +systems and all [Linux web |
| 221 | +operations](http://www.informit.com/store/linux-web-operations-livelessons-video-training-downloadable-9780133927627) |
| 222 | +you may perform are free. Don't get scammed into buying an operating |
| 223 | +system. It's free. |
| 224 | + |
| 225 | +- **Pick a more User Friendly Linux OS**. The last bit of advice I can |
| 226 | +dole out is if you are a first time Linux user, pick an operating system |
| 227 | +which is considered "beginner friendly". Most users consider |
| 228 | +[Ubuntu](http://www.informit.com/store/official-ubuntu-book-9780133905397), |
| 229 | +Fedora and Mint to all fit the bill. I'd recommend choosing one and |
| 230 | +working from there. |
0 commit comments