The Linux operating system is a popular, open-source alternative to Windows. Many software companies, especially startups, run Linux, as do many governments world-wide.
This tutorial goes over the basics of Linux. The tutorial is geared for USF computer science machines and for helping new students setup their system for the semester.
Your home directory will have your user name as part of its name and it should be represented with an icon on the Desktop (e.g. Wolber Home). If you click on that icon, you'll see the sub-folders and files you have in a File Manager window. Some have been setup for you. You'll also want to create some sub-folders yourself-- you can do this by selecting File | Create Folder.
When you create a file, you'll save it somewhere within the file hierarchy rooted at your home directory.
Applications | System | Terminal Program.
The terminal window that appears will allow you to enter Linux commands.
When you login to your CS account, your home directory is /home/yourUserName
For instance, Professor Wolber's is /home/wolber
You also have a web directory: /home/web/yourUserName
Files put into this directory are accessible to the public from any browser. You could put a homepage or other web pages here.
lists the files in your current directory.
tells you where you currently are in the file system.
creates a new sub-directory called 'samples'.
changes you from the current directory to the sub-directory 'samples'.
changes you from wherever you are to your home directory. For Wolber, this command is equivalent to typing:
takes you up in the directory hierarchy, e.g., if you're in /home/wolber/programs, it will take you to /home/wolber.
changes your password. You should do this soon.
cp src dest
copies a file named src to a file name dest.
mv src dest
renames a file named src to new name dest. You can also use mv to move files to different directories.
removes a file (be careful)
removes a directory (be even more careful)
Let's say you wanted to copy all the files in one directory to another directory. The asterisk is a wild card meaning 'all files'. So the command
$ cp *.* /home/wolber/.
copies all the files with a name that matches *.* from the current directory to the directory /home/wolber. *.* can be read as anything followed by a dot followed by anything.
The . after wolber/ means to give the copied files the same name as the original.
$ cp *.txt /home/wolber.
copies all files with extension 'txt' to the directory /home/wolber.
0. Go to your home directory
1. Create the sub-folder 'labProjects' from your home directory. Type:
$ mkdir labProjects
You'll put all the programs you write in class here.
2. You can get to the new sub-directory by typing:
$ cd labProjects
3. You can get back to your home folder with:
$ cd ..
.. means go up in the directory hierarchy.
4. Now check the GUI to see if your commands have really changed things. Click on your Home Icon. It should now list an icon for the labProjects folder.
5. Open the gedit Text Editor at Applications | Accessories | Text Edit. Use the editor to create a file with a single Python command:
Save the file in your home folder and named it 'hello.py'
6. Back In the terminal window, type:
This should list the files in your home directory, including 'hello.py'
7. Copy the file into the labProjects sub-folder. Enter:
$ cp hello.py labProjects/.
This means to copy hello.py (the source) into the sub-folder 'labProjects and keep the same file name ('.' means same name).
8. Navigate to the labProjects directory and make sure the file was copied.
$ cd labProjects
9. Navigate back home and see that there is still a copy of hello.py there:
$ cd ..
10. Move a file. Move is like copy, but it removes a file from its original location.
Move the file to the samples directory using the mv command.
$ mv hello.py labProjects/hello2.py
$ cd labProjects
You should no longer see hello.py in the listing of your home folder. You should see both hello.py and hello2.py in the second ls listing (of labProjects).
11. Remove hello2.py
$ rm hello2.py