• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/40

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

40 Cards in this Set

  • Front
  • Back

What is the difference between home directory and working directory?


Home directory is the default working directory when a user logs in. It contains user's personal data, configuration files, settings of a software etc. The content of home directory is private and the user has a complete control of it. Every user will have one home directory and will have complete control over it. On login, home is the default working directory for the user.



Working directory is the directory in which the user is working currently. Working directory can be changedusing cd command. The home may also be the working directory, if the user is working in it

What is the difference between internal and external commands?


Internal commands are the commands that are executed directly by the shell and already loaded in the system. Internal commands don't require a separate process to execute them (help):



cd, pwd, history, help, echo, exit



$ type cd > cd is a shell builtin



External commands are loaded when the user requests for them and will have an individual process.


External commands are executed by the kernal. Those commands are stored in bin directory (/bin or



/user/bin): Is, cat, less, grep, cp, mv, ps



$ type cat > cat is /bin/cat

How many VI editor modes do you know?


Three modes:



• Command Mode: letters or sequence of letters interactively commands. [ZZ, h, j, k, I,/]



• Insert Mode: Text is inserted. [a, A, i, I, o, O]



• Command Line Mode: enter this mode by typing ":" and entry command line at the foot of the screen.


How can you terminate VI session?


Use command: ZZ that is save changes and quit.


Use command line: ":wq" that is write changes and quit.


Use command line: ":q! " to ignore changes and quit.


How can you copy lines into the buffer in command mode?


yy Copy a single line defined by current cursor position



3yy Copy 3 lines. Current line and two lines below it.



ggyG Copy entire file. (gg - gets the cursor to the first character of the file, y - yank, G - go the end of the file)


How do you list files in a directory?


Is List directory contents



Is -I (I-use a long listing format)


How do you list all files in a directory, including the hidden files?


Is -a (-a, do not hide entries starting with.)


How do you find out all processes that are currently running?


ps -fa (f - does full-format listing. a - all processes)


How do you find out the processes that are currently running or a particular user?

ps -fau root (u - effective user ID (EUID) or name)



How do you kill a process?

kill -9 8 (process_id 8) or kill -9 %7 (job number 7)



kill -9 -1 (Kill all processes you can kill.)



killall - kill processes by name most (useful - killall java)


What would you use to view contents of the file?

less file_name


cat file_name


pg file_name


head file_name


tail file_name


vi file_name


What would you use to view contents of a large error log file?


tail -n10 file_name ( last 10 rows)


How do you log in to a remote Unix box?

telnet server_name



ssh -I server_name

How do you list contents of a directory including all of its subdirectories, providing full details and sorted by modification time?


Is -lac (-a all entries; -c by time)


How do you create a symbolic link to a file (give some reasons of doing so)?


In [OPTION] ... TARGET [LINK_NAME]



In -s ./file_name link_name to remove rm link_name or unlink link_name


Links create pointers to the actual files, without duplicating the contents of the files. That is, a link is a way of providing another name to the same file. There are two types of links to a file: Hard link, Symbolic (Soft) link


• Hard Link:


Is a pointer to a file or program but NOT a directory.


If the linked file is moved or destroyed, the link is not broken.


Hard links can NOT span from one drive to another.



• Soft Link:


Is a pointer to a file, program or directory.


If the linked file is moved or destroyed, the link is broken.


Soft links CAN span from one drive to another

How do you check for processes started by user 'root'?


ps -fu root (-f -full_format u -user name)


How do you start a job on background and switch back to foreground?


$ command1 & Switch from foreground to background hit ctrl+Z: bg %1 [1 is the job number, not the PID]


fg %1


What utility would you use to replace a string '2001' for '2002' in a text file?


sed -i 's/ old-word/new-word/ g' ./file_name [perl pie's/old word/new word/g'input.file>new.output.file]


What utility would you use to cut off the first column in a text file?

cut -f1,2,4 -d ' ' old_file > new_file


awk -F" " '{print $1, $2, $4}' old_file > new_file



How to copy file into directory?

cp /tmp/file_name. (dot mean in the current directory)



scp /tmp/file_name.



rsync /tmp/file_name .

How to remove directory with files?


rm -rf directory_name


List the three main parts of an operating system command:


The three main parts are:



Command



Options



Arguments


What is the difference between an argument and an option (or switch)?


An argument is a filename, directory or name.



An option is specified when you want to request additional information


What command do you type to find help about the command who?


man who

What are two functions the mv command can carry out?


The mv command moves files and can also be used to rename a file or directory.

What is the difference between > and >> operators?


The operator > either overwrites the existing file (WITHOUT WARNING) or creates a new file.



The operator » either adds the new contents to the end of an existing file or creates a new file.


How do you estimate file space usage?


du -hs Summarize disk usage of each FILE, recursively for directories.



h - human-readable print sizes in human readable format (e.g., lK 234M 2G)



s - summarize display only a total for each argument


How can you see all mounted drives?

mount -I

How can you find a path to the file in the system?


locate file_name locate - list files in databases that match a pattern


What can you tell about the tar Command?

The tar program is an archiving utility. It can combine an entire directory tree into one large file suitable for transferring or compression.


(c - Create, x - Extract, v - Verbose)



Create: tar -cvwf file.tar myfile.txt or Create:


tar -cvwf file.tar /home


Extract: tar -xvf file.tar


What types of files you know?

Files come in eight flavors:



Normal files


Directories


• Hard links


• Symbolic links


• Sockets


• Named pipes


• Character devices


• Block devices


How to copy files from on computer to another?


scp -r user@hosdt: /home/qa/file.txt .



(r - Recursively, Copy entire directories.)


If you would like to run two commands in sequence what operators you can use?


; or &&



; - Second command will be run automatically.



&& - Second command will be run only in the case the first was run successfully.



Is -la;top


How you will uncompress the file?


tar -xvf file_name.tar



To save disk space and bandwidth over the network all files are saved using compression program such as


gzip



tar -xzvf file_name.tar



z - Decompress and extract the contents of the compressed archive created by gzip program


(tar.gz)


How do you execute a program or script, my_script.sh in your current directory?

./my script.sh or /home/user/my_script.sh (if script not on Path)



. ./my_script.sh (dot space dot slash) ( This executes the script in the current shell)



sh my_script.sh if script is NOT an executable ( chmod+x file.sh)



my_script.sh if script IS on PATH (echo $Path)


What does grep () stand for?


General Regular Expression Print


What does the top command display?


Top provides an ongoing look at processor activity in real time. It displays a listing of the most CPU-intensive tasks on the system, and can provide an interactive inter-face for manipulating processes. (q is to quit)



top -n 2 n - Number of iterations limit as:


-n number


How to find difference in two configuration files on the same server?


Use diff command that is compare files line by line



diff-u/usr/home/ABC.conf/usr/home/ABC2.conf



( в одну строчку)

Please write a loop for removing all files in the current directory that contains a


word 'log'


for i in * log*; do rm $i; done


How to switch to a previously used directory?


cd -