Xubuntu, Command line

This is article about Xubuntu 12,04 (Linux OS) command lines orders. Here you can find couple of the easiest ways to easy access your operating Linux system files, make new files, running thinks as a administrator (basically using sudo-commands) and searching data. Using terminal emulator you can thinks quicker and you can access information that you haven’t seen before.

The computer

I used this computer in doing this article

  • OS (operating system) Windows 7 home premium 64.bit, service pack 1
    Processor Intel(R) core(TM) i5 CPU 650 3,2 Ghz
    Ram 4 Gb
    Hard drive SAMSUNG HD103SI ATA
    Graphic card Nvidia Geforce GTX 460
    CD/DVD Drive HL-DT-ST BDDVDRW CH10LS20 ATA
    Direct X 11

And I used LIVE-DVD Xubuntu 12,04 for testing xubuntu command line

How to access terminal emulator

So where I can access my console? Simply in Xubuntu 12,04 go with your mouse bottom of your screen and wait a moment. Then comes a little pop ups and one of them is terminal emulator. You can also go to top left corner, click the icon open folder tree, choose accessories and choose terminal emulator. I have heard that there is also quick selection in your keyboard but I haven’t found it yet.

There are some thinks that you should be aware of while using command line. As if you know already, you are able to lot’s of thinks quicker with terminal emulator, but you can also make pretty much harm on your computer if you order it to remove some important files about your operating system (in this case from Xubuntu 12,04). So, if you come to this kind of situation where you are uncertain what will happen, thinks twice what you’re doing and it’s not stupid to make backups of your most valuable files (documents, media files, pictures, maybe some special projects and installation programs)

Basic commands

This is a list of thinks you can do with the terminal emulator.

  • pwd , this shows your current place in folders. It should be like this when you start if you are running LIVE-DVD  /home{xubuntu
  • ls , this command shows all the files on your working directory. Like if you are running the LIVE-DVD /home/xubuntu should so a list of folders that are in that root.
  • cd , this command is known as change dictionary. What it does it changes the dictionary in your currently working directory but you can also travel with it if you know the corresponding route. Like if you are in /home/xubuntu there is a folder named Documents type this to console; cd Document . Now you should be in this kind of place /home/xubuntu/Documents . To move your current location one dictionary up type; cd ..   .
  • mkdir {name of the folder}, makes a new folder in corresponding directory. Let’s make a new folder in documents. Go to your document and type ; mkdir Test . To see did anything happen simply type; ls . There should be now Test named folder in documents.
  • nano {text file name}, makes a text file in your current directory. Let’s make a text file to folder Test named exercise. Go to folder Test and type; nano exercise . Then terminal emulator opens a new window for you and type something in it. Then press ctrl + x, y and enter. Now you have done a text file. If you don’t type anything to in it text file just vanishes because nothing was in it.
  • mv , this is command to move or rename the folder. to rename folder (in this example Test is renamed Testing) ; mv Test Testing . Remember, you can only rename thinks that are in your current dictionary. To move folder different location type this; mv {folder name} /home/Documents/{folder name} . To move folder just one dictionary up type: mv {folder name/text filename} ..  .
  • cp , this is command to copy text files for example. To copy whole folder type this kind of lin;: cp -r {folder name] /{where to copy that folder} . That little -r means recursive pick, it copies the the whole folder, not just it name. If you only need to copy text file and rename it like 1 -> test1 type; cp 1 test1 . To copy and rename the copy you can use this command; cp -r {foldername}/ {new name} .
  • rm , remove folder, if you want to remove the whole folder with text files in it, just type this in to command line; rm -r {folder name} . One thinks to remember, NO QUESTIONS ARE ASKED ABOUT REMOVING THIS OBJECT. Computer does what you told it to do. And if you want to remove more than two folders at the same time, just type the names of folders at the end of the command.
  • echo {text filename} , this command shows you what is in the text file. it kind a prints it to your terminal. To see only the text files text type this: echo {text filename} |less . To exit this view press q=means quit. You can also type; less {text filename} . This also prints the same view and q to exit.
  • setxkbmap fi , this command changes your keyboard to Finnish letters.
  • date ,this is the command to show you current date, year and time.
  • ifconfig ,this command shows you this PC ip-adress.

Commands you run as Admin

Here is a little list you can do as Admin. Somethinks doesn’t need administrators privileges but they can be count as a administrators commands because of them nature.

  • sudo apt-get update , this is command for OS to check all available updates for your programs, drivers and stuff. This is a most crucial think to do every time before running any other apt- commands in its name. This is because you can’t install any other software before you have made this check.
  • sudo apt-get install {programs, softwares name} , this is the command for OS to start downloading named software from Ubuntu Software Center. If you want to download software that cannot be found from USC, you have to download it manually from web. If you want to install many programs, simply name them and press enter to proceed. Like to get VLC and Banshee media players type; sudo apt-get install vlc banshee .
  • apt-cache search {words to describe program you are looking for} ,this is a command to search different kind of softwares from USC from emulator. If you don’t like this view of looking new software, simply open USC manually from your task bar and start searching.

These are softwares that I use and install when I use Xubuntu.
sudo apt-get install libreoffice vlc mixxx banshee p7zip inkscape gimb mypaint miro
I tried few new software, like mixxx, my paint and miro.When I first tried to make this command I accidentally mistyped two of these programs so at first nothing happened. I mistype libreoffice (I wrote lipreoffice) and inkscape (I wrote ingscape). So that was fail and what happened, terminal emulator didn’t start downloading anything because of these two mistypes. When you want to use terminal emulator to download software, you need to be very specific what programs you name.

Your log files

With terminal emulator your tool you able to access most valuables information consider about your personal computer, your log files. Because I’m now running LIVE-DVD nothing I do is going to affect my personal computer. But if you have installed Xubuntu, this is your own domain of personal and maybe complex data. But if you look closely, you are able actually read logs, they are written in simple English. Here is some key elements to acquire these information

  • First type go to your root ( / ) typing; cd / . Now look what files and folders are located here and select var named folder. Then when you are inside of that folder look what else here is. All of your precious logs.
  • To see last lines of some log type; tail {log name} . To see them only in your window remember typing |less . If you want to follow that log type; tail -F [log name} .
    To end following press ctrl + c to end that command.

I find out that in author.log you can find which sudo commands  has been success. When I used terminal emulator to download some programs there was every piece of data that was happened. There was name who did download and what (in LIVE-DVD xubuntu used sudo because no other users has been created) and how many different name programs that user did download. And then there was also information was that command success or not, when that command was ordered to do and when it was done. My first successful sudo command was apt-get update because before I could start downloading any software at all I had to update my xubuntu update list.
This can be very great think in corporations where there are three to eight workers who creates new accounts, run maintenance and repairs servers because you can see who did what and when. If you see that something has been forgotten to do you can do it instance of blind searching softwares that has been installed and what has not been installed. Also you can copy these commands if you have to create account somewhat ten to twenty new users.

Explaining the log file

Some time people thinks that logs are impossible to understand, they are something mythic and ancient forbidden language that no one should be able to understand. Well at first you look at it, it seems kind a weird (lot’s of numbers and capital letters) but eventually you can read it. Here is one log file that can be found at /var/log/author.log after you have give command to update your update list.

Jan 28 16:38:43 xubuntu sudo:  xubuntu : TTY=pts/1 ; PWD=/home/xubuntu ; USER=root ; COMMAND=/usr/bin/apt-get update

So what can we read it. First there is date and time the sudo command was given (Jan 28 16:38;43). Second is computer name (xubuntu) and then there is who gave that sudo command (xubuntu). In your own computer there is always or should be different names in places computer name and user name. Back to business, Third line (TTY=pts/1) this is one that I don’t know really well, but I think that means which terminal/computer was given. The fourth (PWD=/home/xubuntu) this means where that user was when that order was given, in this case user was in /home/xubuntu directory. The fifth line (USER=root) means users level (well means that was user administrator or average user). The last line Sixth (COMMAND=/usr/bin/apt-get update) means what command was given and where you kind find that text file. Yes believe or not, this is a text file. In that text file there is program or something like that that can be executed when user gave that order.

**Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. GNU License 3 (link)**

– Tuomas Törmä

Resources

  • Karvinen, Tero , Teaching lessons in Haaga-Helia spring 2013 consider about Linux as a Server
  • Karvinen, Tero, Command Line Basics article (Link) and Commands for admin (Link)
  • My own discoveries with terminal emulator
  • Update 1,01 (add new caption called Explaining the log file and change some minor typos, add my name at the end of article and edited spelling) 28.1.2013 19.01
    Update 1,02 (I gave GNU license for this article)
    Update 1,03 (Couple typos corrected, edited spelling)

Leave a comment