Linux for Dummies

Linux for Dummies

Linux for dummies: Introduction Log in into your system Tour of the linux files system File management Working with directories File editing File listing: Create directory Removing/deleting files More linux commands Data compression Introduction Linux is an operating system (OS), i.e. it is a software that run on a computer that enables applications and the computer operator to access the devices on the computer to perform desired functions. Linux is similar to other OS such as Windows and OS X. Linux has been used since the 1990s and has become a widely used OS among researchers owing to its GNU General Public License (GPL) which give more flexibility as compared to Copyright. Linux communities come in two basic forms: developer and user communities. And we as user will try to learn and exploit this OS during this course. Linux comes in various flavours and in this document we shall look more into Ubuntu version. Ubuntu is an ancient African word meaning 'humanity to others'. It also means 'I am what I am because of who we all are'. The Ubuntu operating system brings the spirit of Ubuntu to the world of computers. The purpose of this training is to give you competency as a beginning user of Unix/Linux. You will leave from this training with the ability to use Unix/Linux to perform routine file management, file editing, command piping and filtering, file permissions, and some customizations. You will also know how to access Unix reference information and help material online so that you can gain more Unix knowledge when you require it. With these skills, you should be able to accomplish tasks that you might have to do for the rest of the training. What I am assuming about you: ● You know how to use a personal computer, mouse, and keyboard ● You can use a Web browser ● You can get access to a Unix/Linux account ● You are comfortable using computers Log in into your system Once the system has been booted, you will see a screen asking for a username and a password. This will be provided to you by the System Admin or ROOT. When you know these, protect this information, as anyone who learns your password could log in to your account, change or delete your files, and send email in your name. You do not have to protect your username. Tour of the linux files system You can visualize the Unix/Linux file system as an upside down tree. / is also known as the root directory of the Unix/Linux file system. Everything grows from here. This special directory is maintained by the Unix/Linux system administrator. Under the root directory, subdirectories organize the files and subdirectories on the system.The names of these subdirectories might be any name. In the above example, root has 6 sub­directories which are further subdivided into other directories. The 2 users in this system are sue and fred. ● /bin ­ has a set of binaries used when the machine is first booted. Usually only a small subset of commands are available here. ● /etc ­ contains system configuration files and executables. The password file and boot scripts are two examples of configuration files. ● /dev ­ holds special files that are used to communicate with disks, tape, cdrom, and terminals. ● /home ­ usually has the users home directories. ● /lost+found ­ contains lost files. Files that are recovered by fsck are placed in this directory. In linux you can work using the Graphic User Interface (GUI) or via terminal of command line interface (CLI). A video will show you the GUI. Here I will take you through the terminal interface. Even though there are many linux versions, most if not all of them use similar commands that can be entered from a command­line interface terminal. The terminal is not something you should be scared of. It is a powerful tool with lots of uses. To start a Terminal, in Gnome Applications menu ­> Accessories ­> Terminal. OR Keyboard Shortcut: Ctrl + Alt + T Your should get something like this The first word anuj ­ is the login name of the user. Then the second anuj is the name of the computer followed by a : and a tilde ‘~’. The ~ shows that we are in the home directory of the user anuj. After the prompt, represented by a $ sign, we can type our commands. File management Working with directories When you log in, you can issue the pwd command. This will print your working directory. Tab completion is a very useful trick. While typing something – a command, file name, or some other types of arguments – you can press Tab to autocomplete what you are typing. $ pwd /home/john $ Now, if you want to change my present working directory to the directory above your home directory, home, you use the change directory (cd) command followed by ".." (two periods right together, no spaces). This puts you in the "home" subdirectory. Note: when you open a terminal you will be in your home directory. $ cd .. $ pwd users $ You can still go "up" further to the root directory (if the system administrator allows it ­­ it is possible to set the permissions so that you can not "visit" any directory you want): $ cd .. $ pwd / $ You can NOT go any higher in the tree. Now, you could issue the change directory commands like this to go back to my home directory: $ pwd / $ cd home $ pwd /users $ cd john $ pwd /home/john/ $ But there is a shortcut to going back home. Just enter the cd command without anything after it. $ pwd /home/john/ $ cd .. $ pwd /home $ cd .. $ pwd / $ cd $ pwd /home/john $ Now, if you are in your home directory, and you want to quickly go to the root directory, you can string together the two periods ".." separated by slashes "/" to go up two levels to the root directory. Like this: $ pwd /home/john/ $ cd ../../ $ pwd / $ Now, this is all fine and good, but what if you want to organize my files in some subdirectory of your own. You can create a subdirectory in your home directory using the mkdir command. $ pwd /home/john $ mkdir Project $ cd Project $ pwd /home/john/Project $ $ cd ~ ~home $ cd ~john Question: What will “cd ~/john” do? Unix/Linux keeps track of files and directories of files using a file system. The names that you come up with for your Unix/Linux files need to work within this file system. The way you name files in Unix/Linux is pretty flexible, but there are specific rules you have to follow. In practice, there are also some good habits to get into when making your own files. You can name a file in Unix/Linux using any combination from the following sets: {a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z} {0, 1, 2, 3, 4, 5, 6, 7, 8, 9} {period (.), underscore(_), comma(,)} You can not name a file period (.) or period period (..) or (\). Directories are files in Unix/Linux, so directory names follow these same rules also. Unix/Linux File Naming Practices ● You need to follow the official rules for file naming in Unix/Linux, but here are some good practices that I've found also help keep things straight: ● Avoid naming a file with the same name as a Unix/Linux command. ● You can find out if a name is a Unix/Linux command by using the man command. ● Use file extensions that are widely recognized when possible. ● For example, if you create a text file, use the character string .txt as the last part of the file name. ● Unix/Linux cares about case,i.e. the file Alpha.txt is different from alpha.txt. ● The capital letter is only going to cause you problems with trying to remember if the filename or directory name has a capital letter or not. Simply use all lower case. It makes life easier. ● Start a file name with a letter or number. If you start it with a dot (.), it will be a hidden file. ● Make your names short, but not cryptic. Use correctly­spelled nouns when possible. For example, store your inventory in inventory.dat and not invtry.dat. File editing There are several commands to open, create, edit or view a file in linux. pico ­ Simple and very easy to use text editor To launch pico at the terminal prompt type $ pico Your screen should look similar to this: This is very limited and light at the same time. You can use it to quickly open and edit txt files. We shall use pico to create a txt file containing the following: “This is a test txt file My name is Nadeem I live in South Africa” Now save the file under the name my_first_pico_file.txt To view the content of a file, the more command is quite useful $ more my_first_pico_file.txt cat ­ Allows you to look, modify or combine a file. $ cat my_first_pico_file.txt This is a test txt file My name is Nadeem I live in South Africa Now we shall use cat to concatenate 2 files. $ cat my_first_pico_file.txt my_first_pico_file.txt > my_first_pico_file_concatenated.txt $ more my_first_pico_file_concatenated.txt This is a test txt file My name is Nadeem I live in South Africa This is a test txt file My name is Nadeem I live in South Africa Remember Unix/Linux are case­sensitive.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    12 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us