Well, too often (especially in the IRC channel) there was a time in which even the most novice users are faced with a terminal. He has many names: the terminal, shell, console, \"command prompt\" even as the remains of those who are familiar with Windows. Many people are afraid for some reason or another, so this tutorial will try to give you the most basic of commands to allow basic system navigation and action from the comfort of your keyboard.
Let\'s get started shall we? Since the Mint version everyone can be different, I will not detail how to actually open the terminal. I would assume you can find it in the menu or by right-clicking on the desktop.
1. You can do almost anything in the terminal you will also be done from the GUI interface.
2. Most commands are designed to work in the terminal first, then put a GUI on top of them. That\'s why some may feel clunky GUI - they are an afterthought at times.
3. The default location for you to open a terminal from the menu in your home folder, also known as ~
4. Your current directory can be noted by. operator. Most of the orders when they act on the election of the current folder, operates on.
5. Command, location, and file are case sensitive. / Home is not the same as / or Home / Home.
6. Use the tab key to complete the file name. If you have old drivers entitled, for example,
driver-128947232jaseu.sh, simply type the dri and will fill in the rest, as long as you do not have 2 names begin with \"dri\" and if you do, add another character to make it \"driv\" and try again.
7. Almost any command can be read in full using the manual or by typing-h or - help after writing an initial order. This syntax is a good man command_name, command_name-h, or command_name - help.
8. To get more information, you can use the info. A command can be searched by using command_name info. For most of the commands that are part of the coreutils package, one can find info also use coreutils where command_name info command_name prayer replaced with a search command.
9. Almost every command can also explicitly show what happened. This is done usually by the-v or - verbose
10. You can specify multiple command flag for a command at a time to get more information (see example ls-al below.)
11. Command name is not always blunt - because of limited space in the old days of Unix them shortened, and the convention stuck.
cd -> Used to navigate directory. You can move to the location of the road.
1. This cd will move you back to your home, just like cd ~
2. cd .. This will bring you back exactly one directory. Started at / home / justin / Desktop, cd .. would put me into / home / justin. It can be expanded, cd .. / .. / Desktop instead of the site will bring me back 2, from Desktop to / home.
3. cd foldername / This will move you forward to a given folder in your current folder. Note the missing prefix / it is an important omission. if I am in / home / justin and i want to get to the Desktop, I have to type cd Desktop / without / before the Desktop. Typing / before putting us on the root file system, which is not true.
4. cd / some / other / This path will lead you to a specific folder, if it exists exactly as typed. Do not forget your tab completion!
ls -> Used to create a list of the folder contents. You can see the different types of file and folder attributes.
1. ls By itself, ls will only display all the files in the current folder. Of fact # 4, this is really not ls.
2. ls-l Providing a longer list format including the owner, permissions, size, and date modified.
3. ls-a Displays hidden files and folders as well as the normal list.
4. ls-al Combine option to show hidden files and second in the long format.
5. ls-h Show the file size in human readable format (K, M, Gbyte) filesizes instead of bytes. Often used in conjuction with-l flag.
6. You can view the files in the directory you are in. If I am not even in / home / justin / Desktop, and I want to see the file in / home / justin, I could do an ls .. file / list the directory again (and do not have to go back to do it.)
cp -> Copying file
1. cp file / path / to / folder Copy the file specified for the given path.
2. cp-r folder / path / to / folder recursively Copy the contents of folder to another folder.
3. cp extension * /. path / to / folder copy the files with the extension given to the new folder. To copy all the files doc., Being cp * doc / path / to / folder and. Folder must exist.
4. cp name * / path / to / folder Copy all files that begin with a \'name\' to a specific folder. To copy all the files that begin with an example, an example cp * / path / to / folder and the folder must exist.
mv -> Move Files
1. The syntax of mv is similar to the above example with cp freed example # 2. mv does not take the-r flag since moving folder also moves its contents. The syntax is not correct in every respect, but it works with the example above. Consult your manual page for more details.
rm -> Delete file
1. For all intents and purposes, delete files via rm is permanent. Do not use the Trash Bin. Use with caution and make sure you explicitly delete what you want, not what you think you want. If you decide to get fancy with your delete command, it might come back to bite you.
2. rm Remove files from the specified file system.
3. rm-r folder Delete specific folders from system
4. Delete the folder rm-rf force of system folders. This command can severely break your configuration if used incorrectly because it will not ask you if something important is being removed. If you have to use this, the more likely something is broken or there is a mistake made. This should only be used as a method and last but not recommended.
nano -> command line text editor full
1. One can edit the file using nano in the terminal to perform a quick and dirty file all the way up to full configuration. This is useful, but keep in mind to handle plain text files and program files, things like MS Word document will not open properly!
2. If a file is owned by root, can not be edited as a normal user. must be preceded by sudo nano to save the changes. If not, it will open in read-only mode.
3. newfile.whatever nano Nano creates a new file with the specified name and open it for editing.
4. Nano nano existing_file open an existing file for editing.
5. Of the nano
1. Save the file by using the key combination ctrl + o, and either change the name or press entier to keep the same name. This will save the file.
2. Exit nano by using ctrl + X key combination. If you have unsaved changes, it will ask if you want to save.
mkdir -> Create directory
1. mkdir FOLDER_NAME Create a folder with a specific name
2. mkdir-p / path / to / folder / Create each folder name as necessary. To make a folder / home/justin/newfolder/2ndfolder, and only the / home / justin exist, using mkdir-p will create two directories Newfolder and 2ndfolder.
ps -> list process
1. ps aux detailed list of all processes running on the system, including users, Process ID (PID), and the name of the process. Using this, one can see the list of them and if necessary, kill the unnecessary processes or jammed.
kill / killall / xkill -> Kill the offending process.
1. kill PID PID is the reference number of the offending process. People have to get PID of a command like ps aux. If the process refuses to die, one can alternatively specify the kill -9 PID to stop the process in any way, even uncleanly or if it will mess up the system.
2. killall killall kill the program * name * all instances of the word program. If there is an open session for example 3 firefox, firefox killall will do just that; kill all firefox sessions. killing will only take a certain PID of the process you want to kill the offending firefox, and kill the only one.
3. xkill is a way to click and kill the GUI window. Typing in xkill should give the skull and crossbones icon-clicked and the next window will be killed.
Pipe -> The most useful thing you\'ll learn in * NIX. Redirect the output of a program to input anothers.
1. Pipe is represented by a \'straight bar\' otherwise known as the | key\'\'.
2. It is rarely used in the Windows key, often found on the backslash key.
3. They are used to link commands together. Pipe takes the output of one command and routes to be used as input for the second command chained together.
4. Consult online resources with more information about the pipeline and its use because there is volume.
> And >> redirectors -> Send output to a file instead of the terminal.
1. > Used to * overwrite * the existing contents of the file and replace with the new output of the command.
2. Used for * >> * append information to the existing file. It is useful for logging.
3. Example: ps aux> processes.log Sending the output of ps aux to processes.log file to see the output of the command in the text editor and overwrite the current contents of the file.
tee -> Send output to both file and terminal
1. tee used in conjunction with a \'|\' to take command and send the output elsewhere. This is useful if there is a fault with the fly screen before you can read it, the way no matter what happens on the screen is also captured to file.
2. Example: dmesg | tee boot.txt will run the command dmesg that shows the initial boot, and \'|\' to send the output of dmesg to a tee, which then does its job and sends it to the terminal boot log txt file ..
Execution File -> So, you want to run a file or program from the terminal? Make sure it is marked executable. If not, see Quick Tip # 4 below.
1. Need to run the file in the current directory after a marked executable? The / operator. Can execute the file as a regular user as long as you do not need root privileges. / Literally. Means \"the current directory\" so it does not work on files outside of this directory.
2. No need to run the file in the current directory? You must provide the path to the program that executes the right. If this is a python program, it python / path / to / file and if it is a shell file, is sh / path / to / file as an example. Of course there are other programs, but this will be the most common for beginners.
3. Need to run the file with root privileges because you receive operation is not allowed? Prefix the command with sudo. So, from the above example, sudo python / path / to / file will execute the script with root privileges.
4. Need to run the GUI program from the terminal? Simply type the program name (case sensitive!) And will start. This would make the current terminal can not be used. Close the terminal while the program is open will kill the program. A better way is to program the background, using program_name & and then typing the word out in the terminal to shut it down and keep the process running.
5. Need to run GUI programs with root privileges from the terminal? Prefix with gksudo or gksu and sudo. Use sudo to run a GUI application is a bad habit and should be avoided.
6. Do not, do * not * use sudo just because something is accepted \"Operation not permitted.\" Keep in mind what you are doing that you can actually * destroy * the system by running the command in the wrong place with root privileges. It can not be emphasized enough. Make sure your files are from trusted sources.
1. Lose yourself in the directory? Not sure where you are? Type pwd to print working directory.
2. Want to calculate your disk space quickly? df-h can provide a quick check.
3. Want to calculate the size of the folder or file quickly? du-cksh target_name can do that. Want to calculate the size of the current folder? du-cksh.
4. Need to mark the file executable? chmod + x filename could do that. The next time you see the file you need to execute and not marked executable, now you know how to fix it.
5. Want to mount iso like Daemon-Tools on Windows? Linux has this functionality built in. Simply create a directory somewhere, eg / home / justin / isomount, and issue the command mount-o loop / path / to / myisofile.iso / home / justin / isomount and contents in the folder will be installed in the .
6. Run the previous command, you need to re-run, but you can not remember what it was exactly? Type in history into the terminal and it will print your order history. Want to delete your history? history-c will delete the information.