BASH Commands
BASH stands for Bourne-Again SHell, and is the default command-line terminal environment on our Ubuntu computers. Here is a collection of commonly-used shell commands.
ls
ls
lists the directory contents. By default, it only shows non-hidden files and folders:
ls
Hidden files and folders are shown with the -a switch:
ls -a
Extra information (e.g., timestamps, ownership permissions) is shown with the -l switch:
ls -a -l
cd
cd
changes your directory. Without any target, it sends you back to your home directory:
cd
With a target, it sends you to the named directory:
cd /ubfs/caset/cpmcnorg
Go to the parent directory:
cd ..
~/
is a shorthand alias for your home directory. So the following three commands are equivalent:
cd username #where username is replaced with your actual username cd cd ~/
mkdir
mkdir
makes a directory with a particular name:
mkdir newdirectory
The new directory is created as a subdirectory of your current directory.
cp
cp
copies a file or directory from one place to another directory:
cp thisfile ~/newdirectory #makes a copy of thisfile and puts it in the newdirectory subdirectory
Copying directories is (slightly) trickier because you have to copy both the directory, and all the files in it. This is called a recursive copy:
cp -r thisdirectory ~/ #makes a copy of thisdirectory and all the files in it, putting it in your home directory (~/)