d00 en
d00 en
Day 00
Staff 42 pedago@42.fr
Summary: This document is the subject for Day00 of the C Piscine @ 42.
Contents
I Instructions 2
II Foreword 4
IV Exercise 01 : testDay00 7
IX Exercise 06 : Hello! 13
X Exercise 07 : midLS 15
XI Exercise 08 : Z 16
1
Chapter I
Instructions
• Watch out! This document could potentially change up to an hour before submis-
sion.
• These exercises are carefully laid out by order of difficulty - from easiest to hardest.
We will not take into account a successfully completed harder exercise if an easier
one is not perfectly functional.
• Make sure you have the appropriate permissions on your files and directories.
• On top of that, your exercises will be checked and graded by a program called
Moulinette.
• Moulinette is very meticulous and strict in its evaluation of your work. It is entirely
automated and there is no way to negotiate with it. So if you want to avoid bad
surprises, be as thorough as possible.
• You cannot leave any additional file in your directory than those specified in the
subject.
• Got a question? Ask your peer on the right. Otherwise, try your peer on the left.
• Check out the "C Piscine" part of the forum on the intranet.
• Examine the examples thoroughly. They could very well call for details that are
not explicitly mentioned in the subject...
2
C Piscine Day 00
The time and date displayed on the intra indicate the deadline for
your submission. Past that deadline, you won’t be able to hand in
anything more. These time and date also indicate the start of the
peer-evaluation period for the corresponding C Piscine date. This
peer-evaluation period lasts exactly 24hrs. Once those 24hrs are
up, your missing peer-grading will become 0s and you’ll receive
Moulinette’s grade.
3
Chapter II
Foreword
Here are the lyrics for City Hunter’s theme song "Moonlight Shadow":
[Chorus]
I stay, I pray
See you in Heaven far away...
I stay, I pray
See you in Heaven one day.
[Chorus]
4
C Piscine Day 00
5
Chapter III
Exercise 00 : Pre-requisites
Exercise : 00
Pre-requisites
Notes : n/a
• Write nice things in the e-mail, using at least the following words:
6
Chapter IV
Exercise 01 : testDay00
Exercise 01
• Figure out a way for the output to look like this (except for the “total 1” line):
$> ls -l
total 1
-r--r-xr-x 1 login wheel 40 Jun 1 23:42 testDay00
$>
• Once you’ve achieved the previous steps, execute the following command to create
the file to be submitted: tar -cf testDay00.tar testDay00.
7
Chapter V
Exercise 02
Oh yeah, mooore...
Turn-in directory : ex02/
Files to turn in : exo2.tar
Allowed functions : None
Notes : n/a
• Create the following files and directories. Do what’s necessary so that when you
use the ls -l command in your directory, the output will looks like this :
$> ls -l
total 42
drwx--xr-x 2 login wheel XX Jun 1 20:47 test0
-rwx--xr-- 1 login wheel 4 Jun 1 21:46 test1
dr-x---r-- 2 login wheel XX Jun 1 22:45 test2
-r-----r-- 2 login wheel 1 Jun 1 23:44 test3
-rw-r----x 1 login wheel 2 Jun 1 23:43 test4
-r-----r-- 2 login wheel 1 Jun 1 23:44 test5
lrwxr-xr-x 1 login wheel 5 Jun 1 22:20 test6 -> test0
$>
• Once you’ve done that, run tar -cf exo2.tar * to create the file to be submitted.
8
C Piscine Day 00
You won’t be able to have the same "total 42" line as shown in the
example.
9
Chapter VI
Exercise 03
Kerberos
Turn-in directory : ex03/
Files to turn in : klist.txt
Allowed functions : None
Notes : n/a
• Make sure you have a valid (non-expired) Kerberos ticket. If you don’t have one
yet, get one.
• Once you’ve got at least one Kerberos ticket, write a list of all your tickets into a
file named klist.txt
Those commands will be of use later in the day, so try not to forget
them!
10
Chapter VII
Exercise 04 : Who am I ?
Exercise 04
Who am I ?
Turn-in directory : ex04/
Files to turn in : who_am_i.sh
Allowed functions : None
Notes : n/a
• Now that you have a Kerkebos ticket, it’s time to find out who you are!
• As you may already know, all users at the school are on LDAP: some sort of
rudimentary digital phonebook - for those who remember what a phonebook is...
• In a file called who_am_i.sh, type in the command that will return only the value
of the distinguished name.
The first four lines (starting with SASL) will never be taken into
account for mysterious reasons you’ll understand later on.
11
Chapter VIII
Exercise 05
Who’s with me ?
Turn-in directory : ex05/
Files to turn in : people.sh
Allowed functions : None
Notes : n/a
• Now that you understand the basics of LDAP (sort of), you can start looking for
people.
• In a file called people.sh, type in the command that will list the cn list for all
accounts that have a uid starting with ’z’. This list will only show the cn, in reverse
alphabetical order, and NOT case-sensitive. There shouldn’t be any unecessary
empty lines.
12
Chapter IX
Exercise 06 : Hello!
Exercise 06
Phone number
Turn-in directory : ex06/
Files to turn in : mobile-phone.ldif
Allowed functions : None
Notes : n/a
• Now that you’re LDAP experts, you are going to be able to add your phone number
into the mobile field.
Add your real number: your future teammates will be happy to know
how to reach you!
13
C Piscine Day 00
You can change your email address any time, via the ’email-address’
field.
14
Chapter X
Exercise 07 : midLS
Exercise 07
midLS
Turn-in directory : ex07/
Files to turn in : midLS
Allowed functions : None
Notes : n/a
• In a midLS file, place the command line that will list all files and directories in your
current directory (except for hidden files or any file that starts by a dot - yes, that
includes double-dots), separated by a comma, by order of creation date. Make sure
directories’ names are followed by a slash character.
RTFM!
15
Chapter XI
Exercise 08 : Z
Exercise 08
• Create a file called z that returns "Z", followed by a new line, whenever the command
cat is used on it.
?>cat z
Z
?>
16
Chapter XII
Exercise 09 : diff
Exercise 09
man patch
17
Chapter XIII
Exercise 10 : clean
Exercise 10
• In a file called clean place the command line that will search for all files - in the
current directory as well as in its sub-directories - with a name ending by ~, or a
name that start and end by #
• The command line will show and erase all files found.
man find
18
Chapter XIV
Exercise 11
• Create a magic file called ft_magic that will be formatted appropriately to detect
files of 42 file type, built with a "42" string at the 42nd byte.
man file
19