Defensie Exercises preparing for the exam.

Similar documents
Linux Essentials Objectives Topics:

TestOut Linux Pro - English 4.0.x OBJECTIVE MAPPING: CompTIA Linux+ LX0-103

Computer Systems and Architecture

LPIC-1 System Administrator

Please choose the best answer. More than one answer might be true, but choose the one that is best.

Computer Systems and Architecture

Welcome to getting started with Ubuntu Server. This System Administrator Manual. guide to be simple to follow, with step by step instructions

Introduction to the UNIX command line

Aliases are set manually or in a login script. Aliases that were set manually will be gone the next time you login.

Linux Reference Card - Command Summary

Introduction to remote command line Linux. Research Computing Team University of Birmingham

Red Hat.Actualtests.EX200.v by.Dixon.22q. Exam Code: EX200. Exam Name: Red Hat Certified System Administrator (RHCSA) Exam

Embedded System Design

List of Linux Commands in an IPm

CSCM98 Lab Class #5 Getting familiar with the command line

CENG 334 Computer Networks. Laboratory I Linux Tutorial

EX200.Lead2pass.Exam.24q. Exam Code: EX200. Exam Name: Red Hat Certified System Administrator RHCSA. Version 14.0

Linux Nuts and Bolts

SANJAY GHODAWAT POLYTECHNIC

Disks, Filesystems 1

RocketRAID 2310/2300 Controller Fedora Linux Installation Guide

Embedded Linux Systems. Bin Li Assistant Professor Dept. of Electrical, Computer and Biomedical Engineering University of Rhode Island

Linux Operating System Environment Computadors Grau en Ciència i Enginyeria de Dades Q2

Seltestengine EX200 24q

Unix/Linux Basics. Cpt S 223, Fall 2007 Copyright: Washington State University

[ Terminal ] [ Users management ] Alt +F6 = Terminal switcher. useradd [option] JohnG

Stop all processes and then reboot - same as above startx. Log in as superuser from current login exit

Vendor: RedHat. Exam Code: EX200. Exam Name: Red Hat Certified System Administrator - RHCSA. Version: Demo

Unix as a Platform Exercises. Course Code: OS-01-UNXPLAT

Operating Systems. Copyleft 2005, Binnur Kurt

IBM AIX Basic Operations V5.

Operating Systems 3. Operating Systems. Content. What is an Operating System? What is an Operating System? Resource Abstraction and Sharing

Useful Unix Commands Cheat Sheet

Basic Linux Command Line Interface Guide

Introduction to UNIX command-line II

RH133. Red Hat Linux System Administration

Introduction to UNIX command-line

Accurate study guides, High passing rate! IT TEST BOOK QUESTION & ANSWER. Ittestbook provides update free of charge in one year!

Chapter-3. Introduction to Unix: Fundamental Commands

Introduction to Unix: Fundamental Commands

Exam Questions RH133

Chapter 9. Shell and Kernel

Unix System Architecture, File System, and Shell Commands

Linux Kung Fu. Stephen James UBNetDef, Spring 2017

UNIX System Programming Lecture 3: BASH Programming

Linux & Shell Programming 2014

D. Delete the /var/lib/slocate/slocate.db file because it buffers all search results.

The Unix Shell & Shell Scripts

Disks, Filesystems, Booting Todd Kelley CST8177 Todd Kelley 1

If you had a freshly generated image from an LCI instructor, make sure to set the hostnames again:

Chapter 1 - Introduction. September 8, 2016

Lecture 4. Log into Linux Reminder: Homework 1 due today, 4:30pm Homework 2 out, due next Tuesday Project 1 out, due next Thursday Questions?

Commands are in black

Presented by Bill Genske Gary Jackson

Introduction. What is Linux? What is the difference between a client and a server?

a. puppet should point to master (i.e., append puppet to line with master in it. Use a text editor like Vim.

Introduction of Linux

Linux Kung Fu. Ross Ventresca UBNetDef, Fall 2017

Introduction To Linux. Rob Thomas - ACRC

CSE 303 Lecture 2. Introduction to bash shell. read Linux Pocket Guide pp , 58-59, 60, 65-70, 71-72, 77-80

INd_rasN SOME SHELL SCRIPTING PROGRAMS. 1. Write a shell script to check whether the name passed as first argument is the name of a file or directory.

Welcome to Linux. Lecture 1.1

Linux Essentials. Programming and Data Structures Lab M Tech CS First Year, First Semester

Table of contents. Our goal. Notes. Notes. Notes. Summer June 29, Our goal is to see how we can use Unix as a tool for developing programs

A Brief Introduction to Unix

CS 307: UNIX PROGRAMMING ENVIRONMENT KATAS FOR EXAM 1

(32 KB) 216 * 215 = 231 = 2GB

Disks, Filesystems Todd Kelley CST8177 Todd Kelley 1

Course 144 Supplementary Materials. UNIX Fundamentals

UNIX. Basic UNIX Command

More Raspian. An editor Configuration files Shell scripts Shell variables System admin

Introduction to Linux

Lab on User administration

CSC209H Lecture 1. Dan Zingaro. January 7, 2015

1Z Oracle Linux 5 and 6 System Administration Exam Summary Syllabus Questions

Read the relevant material in Sobell! If you want to follow along with the examples that follow, and you do, open a Linux terminal.

EX200 EX200. Red Hat Certified System Administrator RHCSA

Braindumps EX200 15q

Introduction to the shell Part II

Introduction to UNIX Command Line

Exercise 1: Basic Tools

example.com index.html # vim /etc/httpd/conf/httpd.conf NameVirtualHost :80 <VirtualHost :80> DocumentRoot /var/www/html/

5/20/2007. Touring Essential Programs

Lecture 02: Linux Command Line

Set 1 MCQ Which command is used to sort the lines of data in a file in reverse order A) sort B) sh C) st D) sort -r

Getting your department account

QUESTION BANK ON UNIX & SHELL PROGRAMMING-502 (CORE PAPER-2)

TJU Syllabus for Linux Fundamentals and Applications

Introduction to Linux

UNIX COMMANDS AND SHELLS. UNIX Programming 2015 Fall by Euiseong Seo

Chapter Two. Lesson A. Objectives. Exploring the UNIX File System and File Security. Understanding Files and Directories

File System Hierarchy Standard (FHS)

GNU/Linux 101. Casey McLaughlin. Research Computing Center Spring Workshop Series 2018

Introduction to the Linux Command Line. Ken Weiss HITS Computational Research Consulting Division

Unix. 1 tblgrant projects 0 Jun 17 15:40 doc1.txt. documents]$ touch doc2.txt documents]$ ls -l total 0

1. $ who 2. $ date 3. $ echo $? 4. $ echo $$ 5. $ ps 6. $ echo $PATH 7. $ echo $HOME 8. $ echo \thola 9. $ echo "\thola" 10. $ echo e "\thola" 11.

Unix Introduction to UNIX

Prerequisites: General computing knowledge and experience. No prior knowledge with Linux is required. Supported Distributions:

NETW 110 Lab 5 Creating and Assigning Users and Groups Page 1

Linux Kung-Fu. James Droste UBNetDef Fall 2016

Transcription:

Defensie Exercises preparing for the exam. 1. Stuur de inhoud van het bestand /etc/passwd naar het bestand /tmp/gebruikers en zorg dat het bestand /tmp/gebruikers gesorteerd is in omgekeerde volgorde 2. Wat is de inhoud van de variabele TERM en van HISTSIZE 3. What is the file that stores all your commands and how can you look them up. 4. List all your variables and then list all your exported variables. 5. Add the date command to the ~/.bash_profile Log off and log in. Does the script display the date? (Yes) Now start a bash shell. Is the date printed again? (No) How can you have the date printed with each shell that you start? 6. Make sure that get a welcome message when you login? 7. View the manual pages of the cp command. Is there another way to get help for the ps command? 8. View the filesystem type of /dev/sda1 with 4 different commands. 9. Get a list of all loaded kernel modules. How can you list all loadable kernel modules? Load a kernel audio module and unload it again. 10. What is the result of the following command? # find / -name "*.ko" grep audio 11. Load the snd-mia audio module. Check whether the module is loaded. Unload the module again. Check that it is unloaded. 12. List your process id in two ways. 13. List your parent process id. 14. Create a user called tempuser.

Switch to that user as if you login again. Create a file called tempuser_file Leave the shell you are in. Remove the user but do not remove his files. Find all file in /home that have no owner. What is the userid of the file /home/tempuser? What does this tell you? (The tempuser userid was the UID was the UID that is in the files and the tempuser GID was the GID that is in the file) 15. What information is stored in the directory /etc/yum.repos.d? 16. List the first two lines of the file /etc/passwd and only the first two lines. 17. Wat is het verschil? # mkfs -t ext4 /dev/sda1 # mkfs -t xfs /dev/sda1 18. Wat is het resultaat van het volgende commando? # who 19. Wat is het resultaat van het volgende commando? 20. You are going to test the sticky bit. Create two users: usera and userb Switch user to usera and create a file in /tmp Exit the shell and switch to userb As userb, try to remove /tmp/usera_file Exit the shell and remove the sticy bit from /tmp Switch to userb again and try to remove the file /tmp/usera_file once more. Exit the shell and reestablish the sticky bit on /tmp 21. Create a directory called '/tardir' In the directory /tardir create 100 empty files with your name and a suffix of 1 to 100. Create a tarfile of all the files in /tardir. The tarfile should have your name with the suffix.tar Copy the file to the machine of a colleage, or to 192.168.4.229:/tmp

22. Remove your tarfile. Create a new tarfile that is zipped as well. It should be called your name with the suffix.tar.gz what type of information is in the file? ( Use the 'file' instruction ) 23. You are going to create a startup script. If you are not root, switch user to root. Create a script called 'bootscript' in /etc/init.d that creates an empty file called 'booted' in /tmp. And make the script executable. Create a symbolic link to the script in /etc/rc3.d. The symbolic link is called: S99bootscript Reboot your machine and login again Is your file 'booted' in /tmp? (it should be...) 24. Make sure you are root. Create a file of 10MB called 10MB_file. Create a file of 20MB called 20MB_file. Use the find command to list all files in your current directory that are larger than 5MB. You should see both files. Use the find command to list all file in your current directory that are larger that 10MB You should only see the 20MB file. 25. Elinks is a character based webbrowser. Install elinks. Install httpd Put some text in /var/www/html/index.html Start httpd. Start elinks and see your welcome messages Exit elinks. End of exercises.

1. Stuur de inhoud van het bestand /etc/passwd naar het bestand /tmp/gebruikers en zorg dat het bestand /tmp/gebruikers gesorteerd is in omgekeerde volgorde # cat /etc/passwd sort -r > /tmp/gebruikers 2. Wat is de inhoud van de variabele TERM en van HISTSIZE # echo $TERM $HISTSIZE 3. What is the file that stores all your commands and how can you look them up. ~/.bash_history history (filename for history) (command to list history) 4. List all your variables and then list all your exported variables. # set # env 5. Add the date command to the ~/.bash_profile # echo "date" >> ~/.bash_profile Log off and log in. Does the script display the date? (Yes) Now start a bash shell. # bash Is the date printed again? (No) How can you have the date printed with each shell that you start? # echo "date" >> ~/.bashrc 6. Make sure that get a welcome message when you login? # echo "welcome $LOGNAME" >> /etc/motd 7. View the manual pages of the cp command. Is there another way to get help for the ps command? # man cp # cp --help 8. View the filesystem type of /dev/sda1 with 4 different commands. # fsck -N /dev/sda1 # lsblk -f /dev/sda1 # mount grep sda1 # blkid /dev/sda1 9. Get a list of all loaded kernel modules. # lsmod

How can you list all loadable kernel modules? # find /lib/modules/$(uname -r) grep ".ko$" Load a kernel audio module and unload it again. 10. What is the result of the followin command? # find / -name "*.xz" grep audio (It list loadable audio kernel modules) 11. Load the snd-mia audio module. # modprobe snd-mia Check whether the module is loaded. # lsmod grep mia Unload the module again. # modprobe -r snd_mia Check that it is unloaded. # lsmod grep mia 12. List your process id in two ways. # echo $$ # ps grep bash 13. List your parent process id. # echo $PPID 14. Create a user called tempuser. # useradd -m tempuser Switch to that user as if you login again. # su - tempuser Create a file called tempuser_file $ touch tempuser_file Leave the shell you are in. $ exit Remove the user but do not remove his files. # userdel tempuser Find all file in /home that have no owner. # find /home -nouser What is the userid of the file /home/tempuser?

# ls -l /home/tempuser What does this tell you? (The tempuser userid was the UID was the UID that is in the files and the tempuser GID was the GID that is in the file) 15. What information is stored in the directory /etc/yum.repos.d? Answer: it contains the repository config files that YUM uses to find RPMs. 16. List the first two lines of the file /etc/passwd and only the first two lines. # head -2 /etc/passwd 17. Wat is het verschil? # mkfs -t ext4 /dev/sda1 # mkfs -t xfs /dev/sda1 Antwoord: je maakt een file systeem aan op sda1 het verschil is dat het ene type ext4 is en het andere type xfs. 18. Wat is het resultaat van het volgende commando? # who Antwoord: wie zijn er ingelogd. 19. Wat is het resultaat van het volgende commando? # who wc -l Antwoord: hoeveel mensen zijn er ingelogd. Belangrijk: Je krijgt dan dus niet te zien wie dat zijn, want daar vraag je niet om. 20. You are going to test the sticky bit. Create two users: usera and userb # useradd -m usera # useradd -m userb Switch user to usera and create a file in /tmp # su usera $ touch /tmp/usera_file Exit the shell and switch to userb $ exit # su userb As userb, try to remove /tmp/usera_file $ rm /tmp/usera_file rm: remove write-protected regular empty file /tmp/usera_file? y rm: cannot remove /tmp/usera_file : Operation not permitted

Exit the shell and remove the sticy bit from /tmp $ exit # chmod o-t /tmp Switch to userb again and try to remove the file /tmp/usera_file once more. # su userb $ rm /tmp/usera_file rm: remove write-protected regular empty file /tmp/usera_file? y Exit the shell and reestablish the sticky bit on /tmp $ exit # chmod o+t /tmp # ls -ld /tmp (see that there is a 't' in the permissions again) 21. Create a directory called '/tardir' # mkdir tardir In the directory /tardir create 100 empty files with your name and a suffix of 1 to 100. # cd tardir # for i in `seq 1 100` > do > touch alwin_$i > done Create a tarfile of all the files in /tardir. The tarfile should have your name with the suffix.tar # tar cvf alwin.tar. Copy the file to the machine of a colleage, or to 192.168.4.229:/tmp # scp alwin.tar root@192.168.4.237:/tmp 22. Remove your tarfile. # rm /tardir/alwin.tar Create a new tarfile that is zipped as well. It should be called your name with the suffix.tar.gz # cd /tardir # tar zcvf alwin.tar.gz. what type of information is in the file? ( Use the 'file' instruction ) # file alwin.tar.gz alwin.tar: gzip compressed data, from Unix 23. You are going to create a startup script. If you are not root, switch user to root. Create a script called 'bootscript' in /etc/init.d that creates an empty file called 'booted' in /tmp. And make the script executable.

# echo echo '#!/usr/bin/bash' > /etc/init.d/bootscript # echo 'touch /tmp/booted' >> /etc/init.d/bootscript # chmod a+x /etc/init.d/bootscript Create a symbolic link to the script in /etc/rc3.d. The symbolic link is called: S99bootscript # ln -s /etc/init.d/bootscript /etc/rc3.d/s99bootscript Reboot your machine and login again # shutdown -r now Is your file 'booted' in /tmp? (it should be...) 24. Make sure you are root. Create a file of 10MB called 10MB_file. Create a file of 20MB called 20MB_file. # dd if=/dev/zero of=10mb_file bs=1024 count=10000 # dd if=/dev/zero of=20mb_file bs=1024 count=20000 Use the find command to list all files in your current directory that are larger than 5MB. You should see both files. # find. -size +5M Use the find command to list all file in your current directory that are larger that 10MB You should only see the 20MB file. # find. -size +10M 25. Elinks is a character based webbrowser. Install elinks. # yum install -y elinks Install httpd # yum install -y httpd Put some text in /var/www/html/index.html # echo "Hello Welcome" > /var/www/html/index.html Start httpd. # systemctl start httpd Start elinks and see your welcome messages # elinks http://localhost Exit elinks.