Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 2.2)
- 1)$ find /usr -type f -exec cat {} \; | wc -l > res.txt &
- $ kill -stop -groupprocessnum
- $ kill -cont -groupprocessnum
- 2)$ ps fUosms12
- 3) père : bash
- grandpère : sshd osms12@pts/12
- 4) OK
- 5) find /usr -type d -print | tee res.txt | wc -l
- 6) grep --color -E "^.*home.*$" /etc/* | more
- 7)$ tar zcf rep1.tgz rep1
- $ tar zxf rep1.tgz
- 8) OK
- 9) ### envoyer ###
- cat rep1.tgz > /tmp/jannouletube
- ### recevoir ###
- tar -zxf /tmp/jannouletube
- 10)
- ### Code ###
- #include <stdio.h>
- int fibo();
- int main(){
- int j = 0;
- while(j < 0xFFFFFFFF){
- int a = fibo(10);
- j++;
- }
- j = 0;
- while(j < 0xFFFFFFFF){
- int a = fibo(10);
- j++;
- }
- j = 0;
- while(j < 0xFFFFFFFF){
- int a = fibo(10);
- j++;
- }
- j = 0;
- while(j < 0xFFFFFFFF){
- int a = fibo(10);
- j++;
- }
- }
- int fibo(int n){
- int x = 1;
- int y = 1;
- if(n <= 2) return x;
- else{
- int i = 3;
- while(i <= n){
- int temp = x + y;
- x = y;
- y = temp;
- i++;
- }
- return y;
- }
- }
- ############
- 12)
- ### Code ###
- #include <stdio.h>
- #include <sys/types.h>
- #include <sys/unistd.h>
- #include <sys/wait.h>
- int fibo(int n);
- int main(){
- int pid = fork();
- if(pid == 0) { // fils
- printf("Start fils.\n");
- int j = 0;
- while(j < 0xFFF){
- int a = fibo(10);
- j++;
- }
- printf("Fin fils.\n");
- sleep(1);
- } else { // père
- printf("Start père.\n");
- wait(&pid);
- printf("Fin père.\n");
- }
- }
- int fibo(int n){
- int x = 1;
- int y = 1;
- if(n <= 2) return x;
- else{
- int i = 3;
- while(i <= n){
- int temp = x + y;
- x = y;
- y = temp;
- i++;
- }
- return y;
- }
- }
- ############
- $ ps fU osms12
- 13) $ find / -name "bash*" |& less (|& = toutes les sorties)
- 14) find / -name "bash*" 2>&1 | less (on redirige la sortied'erreur standard dans la sortie standard et on pipe vers less)
- 15) bash1$ mkfifo cmdtube
- bash1$ cat > cmdtube
- bash2$ exec < cmdtube
- bash1$ *entrer commandes*
- 16) bash1$ cat > pipe
- bash2$ exec < pipe >/dev/pts/9
- bash1$ *entrer commandes*
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement