Problems "hello"

  1. Questions
    1. How do you search your man-pages for a given keyword? Hint: man man |grep -B1 -A1 keyword.
    2. Suppose you need to type the command basename. Which characters do you need to type on your system before bash completion can complete your typing?
    3. Suppose you need to type the command mkdir --parents. Which characters do you need to actually type when using bash completion? Hint: on debian based system bash completion can also complete long options to many POSIX utilities.
    4. How do you create a folder with a subfolder (say prog/hello)? Hint: man mkdir | grep -B1 "make parent".
    5. Which option instructs the rm command to ask the user for a confirmation before every removal? Hint: man rm|grep "prompt before".
    6. Which option instructs the rm command to remove a folder with all subfolders? Hint: man rm|grep -B1 "remove directories".
    7. Which unix command lists the files in a directory in one column sorted by modification time with the newest last?
    8. What do symbols ., .., ~ mean in the context of the unix file utilities?
    9. Where will the command cd without any arguments lead you?
    10. What is your home directory? Name also alternative notations.
  2. Exercises
    1. Build the hello world program -- a program that prints "Hello, World!" on the terminal.
      • Create a folder for the exercise, let's say "prog/hello": mkdir --parents ~/prog/hello.
      • Go to your directory: cd ~/prog/hello.
      • Create a file hello.c with the content
        #include "stdio.h"
        int main()
        {
                printf("hello, world\n");
        	return 0;
        }
        
      • Compile and link the program: cc hello.c -o hello.
      • Run the program: ./hello