Useful Basic Terminal Commands On Linux Mint 11 - Page 2
5 Archiving Files
To archive your files so that they use smaller space you can use the gzip command. To gzip files, browse the directory the file is in and enter
The original file will then be replaced by a gzipped package. To ungzip it, simply enter
gzip -d [filename]
which practically are the same commands.
6 Text Editing
There are multiple choices when it comes to text editing since there are many editors you can use, all of them available via terminal. The one you might be used to is gedit. To launch a text file via gedit just enter
Do not forget to pick the right directory and of course, replace [textfilename] with the correct title. Other possible texteditors are nano and vi. Open them with the same command structure as gedit.
Apart from real text editors, there are also commands that give you the content of a text file inside the terminal window. To give you a better overview over texts, there are commands like more, head or tail which only show a specified part of a text file that you can configure yourself using command options.
more gives you the selected textfile page after page. By hitting the Enter key you can easily flip pages until you reach the end of the document.
head -# [textfilename]
head gives you only the top lines of the chosen text file. Replace # with the number of lines you want to be shown with head as well as in tail.
tail -# [textfilename]
tail gives you the bottom lines of the chosen textfile, depending on which value you have given #.
The easiest way to display shorter textfiles inside the terminal is the cat (concatenate) command. Followed by the file's name, it will display the contents right away inside the current terminal window.
cat [file name]
But as the name says, you cannot only display contents but also add contents to it or merge two or more text files into one single, leaving the original files unchanged. To add content to a file or create a new file with the specified content, enter
and type the content that the existing or new file shall have. Leave the input process by hitting Ctrl+D. To merge two or more files into another file which cannot be one of the original files but also an already exisiting one, enter
cat [file_1] [file_2] ... [file_n] > [newfile]
7 Searching for Files
To locate files on you computer, there are multiple quick solutions in command form. If you want to search your whole system for specific files use the locate command. Give the file name or part of it as parameter following the command or the options and the command will give you all paths including the specified name parameter.
There is an extra command to locate executable files on you computer that gives you their full path, however the full name of the executable file is needed to run the command. Replace [executable file's name] with its actual name.
which [executable file's name]
To give you a list of contents located in your current directory, you have the ls (list) command. There are multiple options when using this commands, e.g. to give extra information about the content or to sort it in a specific way, the most commonly used being -l which displays the owner and the rights of each file and folder.