User Tools

Site Tools


quick_tips

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

quick_tips [2013/07/14 21:50]
Bill Taylor [Some Starter Commands]
quick_tips [2019/02/09 10:31]
Line 1: Line 1:
- ===== Quick Tips ===== 
  
- 
- 
- 
- 
- 
- 
-==== Some Starter Commands ==== 
-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. <code>$ man ls                   #type  q to exit man page </code> All comands and most programs have man pages.  
- 
-==== Directories ====  
-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 <code> $ /Folder or Directory/subfolder or sub-Directory/sub-subfolder orsub-sub-directory/file.txt </code>  which could be 
- <code> /home/joe/Documents/file .txt   or     /var/log/apt/history.log </code>   
- 
-==== Terminal ==== 
-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|sudo]]  for more info. 
-==== pwd ====  
-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. 
-==== ls ==== 
- 
- 
-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. 
-==== ls -a ==== 
-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. 
-==== cd ==== 
- 
- 
-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.  
-==== dd ==== 
-To create a bootable USB stick from the ISO image you can use the command: 
- 
-**Example 1**  
-<code> 
-$ sudo dd if=vinux-4.0-dvd-i386.iso of=/dev/sdb 
-</code>  
-  
-**Example 2** 
-<code> 
-$sudo dd if=/home/joe/Downloads/vinux-4.0-dvd-i386.iso of=/dev/sdb 
-</code> 
-  
-   - (input file)  if= points to the ISO file you downloaded. Normally we aquire ISO's by downloading, by default into Downloads. You can cd to Downloads then run like example 1. or stay whereeveryou are and run as in example 2   
-   - (output file) of= points to your USB drive. Your USB device can be /dev/sdb,c,d ......... depending on how many Hard drives you have and how many USB devices are present. Hard drives come first. **Gparted** will list all drives, including USB, and either of the commands below will show ALL connected devices! 
-<code> 
-$ sudo blkid -p -u noraid /dev/sd* 
-</code>  
-or 
-<code>$ sudo fdisk -l</code> 
-**__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. 
- 
- 
-==== More Commands ==== 
-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. 
- 
- ====ls -o ==== 
-Sometimes you will want to see more information about a file or files in a directory than is shown with the simple [[ls|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 I got with 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 both 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 
-<code>$ ls -ao</code> 
-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|ls -a]] in the [[starter_commands|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 
-<code>$ ls -o some_file.txt</code> 
-for info on the file called some_file.txt. 
quick_tips.txt · Last modified: 2019/02/09 10:31 (external edit)