User:Amy Suo Wu/scripting

From XPUB & Lens-Based wiki

Chapter 1

What is the shell?

A user program that accepts and translates human readable comments to computer language (something the kernel can read and process).

Decide whether the following sentence is true or false:
  1. Linux is a collection of programs and utilities glued together by the bash shell. T
  2. Shell manages files and data. F
  3. Shell manages networks, memory and other resources. F
  4. Linux kernel runs programs and loads them into the memory. T
  5. Bash shell is a poor user interface. F
  6. Bourne Shell is also known as /bin/sh. T
  7. Bash Shell is also known as /bin/bash or /usr/local/bin/bash. T
  8. C Shell offers more C like syntax. T
  9. A few commands are built into the shell. T
 10. Linux file system organised as hierarchy. F
 11. To refer to several files with similar names you need to use wildcards. T
 12. Wildcards increase command typing time. F
 13. Command ls is used to list directories. T
 14. rmdir command will only remove empty directories. T
 15. Everything is file in Linux. T
 16. rm -i filename command will prompts for confirmation.
 17. Linux can run many programs at the same time. T
 18. The bash shell is just a program. T
  • Write a command names, which can display the files to the terminal. ls
  • Write a command to list details of all files ending in '.perl' in reverse time order. ls -R
  • Write a command to list your running programs. ps
  • Write a command to list files waiting to be printed. lpq
  • Write a command to delete 3 files called file1.txt, file2.txt, and data1.txt. rmdir file.txt, file2.txt, data1.txt
  • Write a command to creates a new sub-directory called 'foo' in /tmp.
  • Write a command to delete the directory called 'foo'. rm foo
  • Write a command to read all ls command options.


chapter 2

1)

Hello socsoc
Today is Mon Nov  1 21:40:56 CET 2010
Number of user login : 3
Calendar
   November 2010
Su Mo Tu We Th Fr Sa
    1  2  3  4  5  6
 7  8  9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30

socsoc@socsoc-laptop:~$

4) List 10 builtin and external commands.

The -a option can be used to find out if given command is disk file, alias, keyword or function. It will display all of the places that contains an executable available including aliases, builtins, and functions. 

builtin -disown -continue -declare -dirs -enable -eval -exec -exit -export -false

external -ls -false -pwd -echo -date -grep -wc -bash -cat -sh