More powerful than the spiky blue shell
Follow these steps to set up your own repository:
-
Fork this repository on GitHub to create your own version of this repo on your GitHub account, which should also be named
Core-Unix-Utilities
-
Visit your fork and clone that repository onto your computer:
git clone https://github.com/<your-username>/Core-Unix-Utilities.git
-
Push your commits and link the local repo to your remote GitHub repo:
git push -u origin master
-
When you've completed a challenge and want to share it for code review, commit your work and push it to your own remote repo with:
git push
-
Add this GitHub repository as a remote to the local one on your computer:
git remote add core https://github.com/Product-College-Labs/Core-Unix-Utilities.git
-
When you want to access new course materials, just pull from the origin remote repo:
git pull core master
Challenges within each section are meant to be solved in order.
- Print the path of your working directory
- List the files in your working directory
- List the files with a particular extension, like
.txt
- List the files in a subdirectory, like
project
- Navigate to a subdirectory, like
project
- Navigate to the parent directory of your working directory
- Navigate to a nested subdirectory, like
path/to/project
- Navigate to your home directory
- Navigate back to the previous directory
- Print a sentence, like
Hello world
- Print a variable value, like
$USER
or$PATH
- Set a variable
NAME
equal to your first name, then print its value - Set a variable
FULL_NAME
equal to your full name, then print its value - Print all environment variables (names and values)
- Make an alias named
hello
that printsHello world
- Make an alias named
gocode
that navigates to your code directory - Print all aliases (names and values)
- Print what options a command accepts, like
bash
orpython
- Read the manual for a command, like
echo
orls
- Print the file path to a command, like
bash
orpython
- Navigate to the directory
Animals
- Print the contents of the file
Cats.txt
- Print the contents of both files
Cats.txt
andDogs.txt
- Count the words in the file
Cats.txt
- Count the words in all files with the extension
.txt
- Copy the file
Dogs.txt
to a new fileBabyDogs.txt
- Rename the file
BabyDogs.txt
toPuppies.txt
- Make a new directory named
Shelter
insideAnimals
- Move the file
Puppies.txt
into the directoryShelter
- Copy the file
Cats.txt
toKittens.txt
insideShelter
- List the files within the directory
Shelter
- Count the words in all
.txt
files insideShelter
- Try to remove the directory
Shelter
(this should fail) - Remove all
.txt
files insideShelter
- Remove the directory
Shelter
(this should succeed) - Now cry because you just deleted those poor tiny animals
- Print out your user name
- List the permissions (and metadata) of all
.txt
files - Give all users write permission on the file
Cats.txt
- List the permissions (and metadata) of the file
Cats.txt
- Change the owner of the file
Cats.txt
to another user - Now list the permissions (and owner) of the file
Cats.txt
- Try to change the owner of the file
Cats.txt
back to yourself - Invoke the super-user to make the previous command succeed
- List the permissions (and owner) of the file
Cats.txt
again
These challenges utilize more sophisticated Unix utilities. Challenges within each section are meant to be solved in order.
- Print a sentence like
Hello world
into a file namedtest.txt
- Append another sentence
Hola Mundo
on a new line oftest.txt
- Print the contents of the file
test.txt
- Print the contents of the file
numbers.txt
- Print the first 10 lines in the file
numbers.txt
- Print the first 5 lines in the file
numbers.txt
- Print the last 10 lines in the file
numbers.txt
- Print the last 5 lines in the file
numbers.txt
- Print lines 6 through 10 in the file
numbers.txt
- Sort all lines in the file
numbers.txt
- Print the first 2 characters of each line in
numbers.txt
- Print only characters 9-16 of each line in
numbers.txt
- Sort the first 2 characters of each line in
numbers.txt
- Print only the unique first 2 characters of each line in
numbers.txt
- Replace all
o
s with0
s in filetest.txt
- Capitalize all letters in the file
test.txt
- Capitalize all letters in the string
Hello world
- Find the file named
Cats.txt
in the directoryAnimals
- Find all files ending with
.py
in your code directory - Find all files larger than 100 MB in your movies directory
- Find all lines containing the word
one
in the filenumbers.txt
- Find all lines containing the letter
e
at least 3 times in the filenumbers.txt
- Find the
search
function definition in a source code file - Find the
search
function definition in all source code files - Count the lines and words in all source code files
- Find all U.S. zip codes in a file containing addresses
- Find all U.S. zip codes in a file containing addresses