Linux exercise 8 - I/O

  1. Create alias for the rm command in the following way: each time file is removed prompt is provided for the user asking verification for the removal action. This alias should be permanent! Enable alias for the current logged in user. How would you enable the alias system wide for all system users?
  2. Redirect the output from w command to the file users.txt.
  3. Redirect the output from id command to the end of users.txt file. Find out from the manual what id command does.
  4. How does the output from the following commands differ:
    • ls -l
    • ls -l | sort
  5. Create global variable called linuxinfo, which includes the following content:
    • Timestamp: current_date_and_time | hostname is hostname and logged in user is username
    • Example: Thu Oct 08 13:17:04 | hostname is ubuntu-PC and logged in user is testuser
    • Verify the content of global variable using echo command.
  6. Take backup from the current command line prompt and edit the current prompt to be like in the example below.
    • Time (24h) current_logged_in_user own-prompt $
    • Example: 09:28:11 ubuntu own-prompt $
    • Return the original prompt back after verifying the operation of your temporary prompt.
  7. Install cowsay program to your Ubuntu if it is not yet installed. Chain the following three commands:
    • Cow tells the name of the computer AND
    • if the creation of directory called dataset cannot be done into the root directory /, sheep will report it.