- Stands for change directory. Can be used to navigate around the shell
- e.g.
cd instructions
will move your location into the instructions folder cd ..
can be use to move up a directorycd ~
or justcd
can be used to jump back to your home directory
- Stands for list. Can be use to show what files and folders are in your current directory
- e.g.
user@CADS ~ $ ls research instructions animals
ls -l
shows more detailed information of the files, including the permissions and who owns the filels -a
shows all files, including the current one (.
), the above one (..
) and hidden ones (ones that start with.
e.g..secret.txt
)
- Stands for print working directory. It will show you your current location within the file system.
- Stands for concatenate. Can be used to join text files and print the output.
- For these tasks we'll use it to only print out a file to the screen
- e.g.
user@CADS instructions $ cat level1.txt whatever is in level1.txt ...
- nano is a terminal based text editor. It will be used to edit the files of today's challenges.
- usage
nano filename.txt
- Once in nano you can move around as if it was notepad on windows. To close it press ctrl-x, press y if you want to save the file.
- Stands for make directory. Can be use to create new folders.
- e.g.
user@CADS ~ $ mkdir homework user@CADS ~ $ ls research instructions animals
- Stands for copy. Can be used to copy files and folders.
- Usage
cp <file to copy> <destination of file>
- e.g. if you wanted to copy
cow.txt
tosheep.txt
user@CADS animals $ cp cow.txt sheep.txt user@CADS animals $ ls cow.txt sheep.txt whale.txt
- If you want to copy directories you must use
cp -r
- Stands for move. Can be used for moving files and renaming files.
- Usage
mv <file to move> <destination of file>
- e.g. if you wanted to rename whale.txt to fish.txt
user@CADS animals $ mv whale.txt fish.txt user@CADS animals $ ls cow.txt fish.txt
- Prints the current username
- Can be used to add new users.
- You can use the flag
-m
to include creating a home directory - e.g.
user@CADS ~ # adduser -m jeff user@CADS $ ls /home jeff
- Stands for switch user
- e.g.
user@CADS ~ $ su jeff jeff@CADS ~ $ whoami jeff
sudo
elavates the user to root for one command- Usage:
sudo <command>
- e.g.
user@CADS ~ $ sudo whoami root user@CADS ~ $ whoami user
- Apt is a package manager on Ubuntu.
- Packages can be installed using:
apt install <package name>