Basic Ubuntu Commands

From Yardlepedia
Jump to: navigation, search

Below is a list of the most common terminal commands for Ubuntu. It was written based on Ubuntu 9.10 but the vast majority of these commands work on all Linux distributions.

Root access

The term "root access" refers to complete administrative access over a particular system. In most Linux distributions, commands such as installing programs and creating user accounts must be done from the root account. This is similar to User Account Control (UAC) in Windows Vista and Windows 7.

Running commands from the root account is easier than it sounds. In front of the command you wish to run as administrator, just insert sudo (which stands for substitute user do. You'll be asked to type your administrator account password if you haven't done so already in that terminal session.

To change the state of a terminal such that all commands issued in it are run from the root account, enter the command sudo su. To exit this mode, type exit.

sudo <command> # executes <command> from root account


sudo su # switches terminal state to run all commands from root


exit # exits sudo su mode


Navigating through folders and files

pwd # "print working directory"; shows current directory


ls # prints files and folders in the current directory


cd /new/path # changes the directory to a certain path, like /home/root/


cd .. # changes to the directory above your current one; functions like "up one level"


mkdir <directory> # creates a new directory in your current one


rmdir <directory> # removes a directory in your current one


rm <file> #removes a file in your current one


rm -r <folder> # removes a folder regardless of files and subdirectories in it


cp <file1> <file2> # copies file1 into file2


mv <file1> <file2> # moves or renames files and folders


If you hit the tab key while typing a file or directory name, it will autocomplete the name.

Editing Text Files

Many text editors exist for Ubuntu. Of note are nano, emacs, vi/vim and gedit.

  • vi/vim is a powerful text editor that runs completely in the terminal. Its controllers are unusual, and complex however.
  • nano is another terminal based text editor. It is not as powerful as vim but it has simpler controls.
  • gedit is a GUI based text editor, that acts like notepad, but more powerful.
  • emacs is a text editor that works both in GUI and in a terminal. You are forced to use it if you ever take CMPUT 201
emacs <filename> # edits the file with emacs


gedit <filename> # edits the file with gedit


nano <filename> # edits the file with nano


vi <filename> # edits the file with vi


Installing and removing software

Free software is contained in databases called repositories. You can download software from these repositories using the command line.

sudo apt-get install <package name> # installs a specific package


sudo apt-get remove <package name> #removes a specific package


sudo apt-get update # retrieves a new list of packages


sudo apt-get upgrade # upgrades your software


sudo apt-get autoremove # uninstalls unused packages


sudo apt-get dist-upgrade # upgrades your operating system to the newest version


sudo apt-get autoclean # deletes old package files


sudo apt-get check # checks for broken dependencies


Keyboard shortcuts

Tab

is used to autocomplete path and file names.

Ctrl +C is used to terminate processes.
Middle Click pastes data from the clipboard. You can also click both mouse buttons at the same time on mice with no center button or wheel.
The

and 
arrow keys navigate through past commands, allowing you to enter them again.

Ctrl +U deletes your current line.
Home

and End
move to the start and end of a line.

Ctrl +B moves to the beginning of the current word.
Ctrl +K deletes from the current cursor position to the end of the line.
Ctrl + and Ctrl + navigate through words in the current line.
Ctrl +W Duplicates all items in your inventory.

Go to Viridian City and walk north until you reach the Old Man who's just had his coffee. He'll ask if you're in a hurry. Tell him no. Watch a demonstration on how to catch Pokemon.
Fly straight to Cinnabar Island. Get on a water Pokemon and Surf along the east coast of Cinnabar. (Note: in this area, you will encounter Pokemon from the last area you visited. It's a great idea to come here after you leave the Safari Zone, as you can catch Safari Pokemon using regular attacks and Poke Balls, not just food and rocks.)
Keep Surfing until you discover a "glitched" Pokemon (sometimes called "the Missing No"). By the way, you will also receive an "infinite" amount of the item you have in the 6th spot. It's a good idea to clone items like Full Restore, Rare Candy, Lemonade, Max Revive, Poke Balls (especially the Master Ball) and Evolution Stones. A pixelly symbol will appear next to the item, showing that you have many more of the item.