-
Use
uname
to get details on your machine. What is your kernel version ? -
What is your default shell ? What version is it ?
-
Find a list of all connected users to your server
-
Run
ifconfig
to get information about network connections. Did it work ? -
Try to find ifconfig in the system. Hint: It's a system binary
-
Use date to show the current time formatted HH:MM:SS (Hint:
man date
)
-
Create the directory Data and inside the files: data1, data2, data_3, .data, my_name
-
Create the directory Zoo and inside the files: keeper, animals, Visitors
-
Create the directory Progs and inside the files: prog1.c,prog2.c,small_prog,medium_prog,.pro1.exe,my_prog
-
Create the directory Family inside the Zoo directory
-
Create a file named My_name and write your name in the first line and city in the second
-
Create a file named My_family and write the names of 3 family members - each in their own line
-
Verify all files are under the Family directory
-
Copy the file My_name to a file named name
-
Rename the file My_family to Family
-
(Bonus) Create a file called Whole_family that contains the contents of both Family and name
-
Display the contents of Whole_family
-
Go back to your home directory
-
Rename the Zoo directory to My_zoo
-
Copy the Family directory and all its contents to your home directory
-
Delete the directory My_zoo
-
Create two files inside /tmp named after you
-
Calculate the size of your home directory using:
du -shL ~
-
Copy all the files (without directories) from Family which start with a letter, into a new directory called Capital in your home directory
-
Use
ls -ld
to display all files that have an _ in their name under Progs directory -
Delete all files that end with a .c in Progs directory
-
Display all files beginning with data under Data directory
-
Delete all files starting in My or my
-
Display all files whose name ends with a digit, under directories whose name starts with P or D. For example, Progs/cool7 should be displayed.
-
Braces are used to create multiple files and folders in a single command line. Run the following:
mkdir -p day_{one,two,three}/{basic,mid,advanced}_group
How many directories were created ?
You can use Vim Cheat Sheet for a short reference on vim commands.
-
Modify ~/.itools to use the newest vim version (7.3)
-
Copy the file /etc/passwd to a new file named passwd.new in your home directory
-
Type the following lines in the beginning of the new file:
# This is a backup for user admin file /etc/passwd # Author: Luke Skywalker # Author's Father: Darth Vader
-
Go to line 10 and copy it to the beginning of the file
-
Replace all occurrences of the word csh to bash
-
Delete line 6
-
Add line numbers to the file
-
Move line 7 to appear before line 4
-
Save the first 10 lines to a new file named pass.new2
-
Save and quit
-
Open both files in the same vi session. Cut the first 3 lines from pass.new and paste them into pass.new2
-
Save the world: vim-adventures
-
Create a directory named lock in your home directory and inside create a file named tmp_file. Write your name into the file
-
Go back to your home directory and grant read only permissions on lock to all users
-
Edit the file tmp_file in lock directory, add your city in a new line. Did it work ?
-
Change symbolically (using letters) the permissions for all files inside Progs directory to: rw-r--r-w, without changing the permissions for the directory itself.
-
Change absolutely (using numbers) the permissions for all files inside Data directory to read/write for user, read for group, executable for others.
-
Revoke all permissions from Progs folder
-
Move Progs folder and all its files into Data. Did it work ?
-
Create a directory named links and enter it.
-
Create a file named file1 with the line: this is file1
-
Create a file named file2 with the line: this is file2
-
Create a hard link named file3 to file1
-
Create a symbolic link named file4 to file2
-
In your home directory, create a link named Link_to_links to links directory
-
Use
cat
to watch the four files -
Remove file1 and watch the contents of file3
-
Remove file2 and watch the contents of file4
-
Create file2 again using: cat /etc/passwd > file2
-
Watch the contents of file4
-
redirect the output of
ls -Rl -L ~
to a file named list -
Did you get any errors ? Run the same command again, this time redirecting the errors to a file named LsErr
-
Move the contents of LsErr to the end of list
-
Prevent the shell from clobbering files
-
Perform command from (1) again so it will clobber the file list
-
Display the number of files (including directories and links) that have execute permissions for others.
-
The command
rpm -qa
shows all software installed on the system. Count the numebr of software packages installed. -
How can you verify the mozilla program is installed ?
-
Display the total number of files under all subdirectories in your home folder (only the files)
-
Display the number of files modified today ( use a specific date )
-
Use
cal
commnad to create a file named Sat that contains all dates of Saturdays in May 2004 -
Use
mail
to send Sat file contents to your personal mailbox: cat Sat | mail -s "May 04 Saturdays" YOUR_EMAIL@ADDRESS -
Display the largest 3 files in your home directory.
-
Check how many files have execute permissions to everyone.
-
Redirect the output of
ls -lR
to a file named Temp_RE -
Find all lines which start with a "d"
-
Find all lines which end with a "y"
-
Find all lines which contains a digit
-
Find all lines which start with an
l
, a-
, or a.
-
Find all lines which start with a "-" and contains an "n"
-
Find all lines which contains an "o" followed by a "u"
-
A file or directory that has permissions 777 is considered at risk. Locate in all folders under your home directory the list of files in at risk. Store the list in a file named Permissions_Log
-
Find all lines which contains up to 70 characters
-
Find all lines which contains exactly 60 characters but no "."
-
Display the number of files (no directories)
-
Display the number of links
-
Display files (without directories) larger than 20k
-
Display files whose name ends with a ".c". Format the output like
ls -l
-
Delete all files you own under /tmp
-
Display files (without directories) which were updated in the last 4 hours.
-
Find all
.cpp
files which contain the wordmain
-
Find all files which contain at least one line that starts with "#"
-
Find all files which does not contain any digits and print their names
- Create the following files:
- a b c
- a* b*c
- .a? b\ c
-
Define the following aliases:
rm => rm -i cp => cp -i c => clear
-
Create an alias to add executable permission to a file
-
Saving aliases is performed by storing them in a special file. Add the aliases you created to your .aliases file
-
Login again and check the aliases were created
-
Use
less /etc/passwd
to show the contents of the file. Leave it open. -
In a new shell window, locate all your processes using
ps au
. What is the process number of the less command from (1) ? -
Execute
ls -lR /
and freeze it immediately using Ctrl+Z -
Use
jobs
to find the job number -
Resume the process using
fg
. It's ok to end it now with Ctrl+C -
Run the following process:
/tmp/demo.pl &
-
Can you stop the process using Ctrl + C ?
-
Use the special kill to terminate the demo process
-
Use
at
to perform the following and email the results:
- Display all executable files at 14:00
- Backup .aliases at 19:00
- Send "Go Home" email at 17:00
- Create a new git repository and add the following 2 files:
colors.txt
numbers.txt
-
Write some colors into colors.txt, and some numbers into numbers.txt
-
Check the repository's log file. What is the commit number ?
-
Create the following empty files: data1, data2, data3 - and add them to the repository in a commit
-
Check the repository's log file. What is the commit number ?
-
Create the following two empty files: prog1.c, prog2.c, and add them to the repository in two separate commits
-
Modify numbers.txt by adding some more numbers to it. Display the difference between the new file and the saved one.
-
Discard your changes and go back to the saved copy
-
Add some colors into colors.txt, and write your name into data1. Commit your changes
-
Restore the state of the entire project to go back to step 1, step 3, and then back to head
-
Count all non-blank input lines
-
/sbin/ifconfig
prints out information about network interfaces. Use awk to extract your server's IP addresses from the output -
Use
who
andawk
to show only user names connected today -
Print all file names whose size is larger than 500
-
Extract from
/etc/group
all group names which have more than 4 users in them -
man -k word
shows all man pages related toword
. Each output line has the man page name, the man section, and a description. Show only man pages from section 3 related to wordls
-
Show only shells from
/etc/shells
installed in folder/bin