This is an old revision of the document!
Hi. My name is Joe, and we are using my computer (named buster) for this introduction to some common commands. Some keyboard shortcuts will also appear, without explanation.These commands are in a sequence, so work your way through the first time, but each is typed at a prompt. All will also work in a console, but you can scroll up and down in a gnome terminal to compare results such as ls command's. You can also type man "command name" to view manual pages, and type q to exit man page.
$ man ls #type q to exit man page
All commands and most programs will have a man page.
This is the shortest possible mention, so you have a glimmer of the subject, and allow you to make sense of various commands as they are presented. You may think of a directoty as a folder.
< / >The root directory. The starting point of your directory structure, where the Linux system begins. Every other file and directory on your system is under the root directory.
The normal format of an absolute path is
$ /Folder or Directory/subfolder or sub-Directory/sub-subfolder orsub-sub-directory/file.txt
which could be
/home/joe/Documents/file .txt or /var/log/apt/history.log
When we open a terminal,(ctrl+ alt+ T) we are, by default, in our home folder (or directory). The words on the screen before we type anything are called a prompt. mine says joe@buster:~$ That's user@hostname :~$ The Tilda after the colon tells me that I am in my home directory, and the $ tells me that I am normal user. If it is a #, I am super user. See sudo for more info.
Type pwd and press enter.The reply is /home/joe, for me. pwd stands for Print Working Directory, and can be used any time you want to know where you are, Try it as we go to see the path to find your way back later. You noticed that you are now back at the prompt? The command line does what you tell it, and comes back to the prompt. no news is good news! If it can't do what you tell it, it will print an error message.
now type ls enter. ls lists directory contents, in numeric/alphetic order. the list you now have on your screen is Some of the contents of your home dir. The names without extensions are directories Inside your home dir. Desktop, Documents, Downloads are all directories. Note that Vinux /Linux are case sensative. Most dir. start with capitals. The other files visible here are text, mp3, etc.
Our Home dir contains many other files and dirs that are hidden by default. They are mostly program configuration, settings and data files used by the program. You can look, but be careful, it is easy to break things here. type ls -a to see all.
Now we have seen that there are directories in our home that we can't see the contents of. Let's say we downloaded the new Vinux, and want to use it on a spare computer.By default, what we download is stored in Downloads. ls showed us Downloads is in home, so we need to change directories.we use cd for this. type cd Downloads My prompt now is joe@buster:~/Downloads$ The ~ still means home, the forward slash means that Downloads is inside home. now if we type ls we will see that the new vinux is inside Downloads! So as pwd returns /home/Downloads we add /vinux4.0-dvd-i386.iso to form the path for the new .iso.
From inside Downloads we can run example 1. below while we are here, or we can type cd .. to go back to home, OR cd / to go to / (the root Directory. Everything is mounted to root.) and use example 2. In fact we can run example 2. from anywhere! It is a full path from /. example 1. will only work from the directory the .iso is in.
To create a bootable USB stick from the ISO image you can use the command:
$ sudo dd if=vinux-4.0-dvd-i386.iso of=/dev/sdb
$sudo dd if=/home/joe/Downloads/vinux-4.0-dvd-i386.iso of=/dev/sdb
$ sudo blkid -p -u noraid /dev/sd*
$ sudo fdisk -l
dd is potentially very dangerous!
An incorrect if device in the command can result in the overwriting and destruction of data!
Device letters can change when they are reconnected or the computer is rebooted, so reuse one of the methods above to double check if you have any doubt as to what your USB-stick is being called, and double check your typing before pressing enter.
here are some commands to give you more information about, and work with files and programs on your Vinux computer. Unles otherwise stated they can be run in a console or Gnome-terminal and are likely to work on most Linux and many other Unix systems.
Sometimes you will want to see more information about a file or files in a directory than is shown with the simple ls command. Perhaps you have files with similar names and can't remember which contains what, but you know that the one you want was written in March, or is around 3KB, (3 kilobytes), in size. The ls command with the -o option can help you out. Here is a line of output when typing ls -o.
-rw-r–r– 1 burt 613 Feb 19 23:46 webbiz.html The letters at the beginning refer to permissions, r for read, w for write and if there is an x it means that the file is executable. Permissions are shown in three groups, first the file's owner's permissions, then those for the group that bears the owner's name and last for anyone else using the computer. Next comes the file's owner, the file size in bytes, the date and time the file was last modified and finally the file name with its extension if it has one. In the example the owner, "burt" has permission to read and write to the file and those in the group "burt" and anyone else can read the file. It is an html file that contains 613 bytes of data and was last modified on Feb. 19 at 11:46. at night.
There are many options available with the ls command that control what information is shown about files and sub-directories, how they are sorted, units used, etc. These optioncs can be combined like
$ ls -ao
to show permissions, ownership, filesize, and date last modified for all files and dirs including the ones that start with a dot, ".", that are hidden. For more on the -a option see ls -a in the Some Starter Commands section. Putting a file name after your option(s) will give info on that one file instead of all files in the working directory. Type
$ ls -o some_file.txt
for info on the file called some_file.txt.