Section 1

Preview this deck

How to look into file (read only)?

Front

Star 0%
Star 0%
Star 0%
Star 0%
Star 0%

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Active users

0

All-time users

0

Favorites

0

Last updated

6 years ago

Date created

Mar 1, 2020

Cards (95)

Section 1

(50 cards)

How to look into file (read only)?

Front

ls myspecialrootdir/DIRECTORYNAME

Back

temporary

Front

tmp

Back

external programs

Front

the shell runs a program for you (type of command)

Back

What is the special relative pathname for the CURRENT directory? *

Front

.

Back

command to remove files

Front

rm (This is PERMANENT! There is no trashcan to recover)

Back

command to list users currently logged in

Front

who

Back

What command is used to LIST the name of each file in the directory?

Front

ls

Back

relative pathname

Front

If we are in the directory /users/hollid2, the relative pathname of the file Syllabus in the directory /users2/hollid2/unix/ is:unix/Syllabus

Back

You use more capital letters in unix

Front

False

Back

How do you change directory to read permission?

Front

sudo chmod a+r myspecialrootdir if want to add execute permission sudo chmod go-r, a+x myspecialrootdir

Back

command to show current time and date

Front

date

Back

What is top directory in unix

Front

root (slash / ) only used in the beginning

Back

what is the symbol for home directory?

Front

~

Back

Unix account includes

Front

username and password userid and groupid home directory shell

Back

command to concatenate/link files and print out to terminal

Front

cat

Back

What is -l used for?

Front

long format (include file times, owners, and permissions)

Back

What is a disallowed character in unix file name *

Front

forward slash

Back

what is a ls example?

Front

ls /usr/bin

Back

what are examples of cd?

Front

cd /usr & cd ..

Back

userid command

Front

id (uid)

Back

A file is AKA

Front

directory

Back

binaries

Front

bin

Back

filesystem

Front

a hierarchical system of organizing files and directories

Back

command to print working directory

Front

pwd

Back

What is ls -R

Front

lists everything in a directory and in all sub directories recursively (very long) (be careful not to use this when removing)

Back

pathname *

Front

every file has a name

Back

command to show what DISK holds in the directory

Front

df

Back

Each file has a set of ____ that controls who can mess with the file

Front

File Permissions WHAT read r write w execute x + add permission - remove permission = set permission

Back

What is the special relative pathname for the PARENT directory? *

Front

..

Back

What is the point of a unix directory?

Front

tool for conversion of name of file to piece of information of actual file

Back

To access a unix system you need to have an

Front

account

Back

What is the WHO in file permission?

Front

owner u groups g other o all a

Back

Program uses ____ to find files

Front

tag

Back

command to make directory command to remove directory command to remove file timestamp/create blank file

Front

mkdir (can only make directory where already exists) rmdir (useless because you can't delete the directory if there are files in the directory) touch (make file current)

Back

What type of pathname is used to specify a file?

Front

relative pathname

Back

shell internals

Front

commands that the shell handles directly (type of command)

Back

Not everybody knows who their dad is so use

Front

.. example: ls ..

Back

command to copy files *

Front

cp example: cp [options] source dest source = name of file want to copy dest = name of new file (can be used to make a new file)

Back

absolute pathname *

Front

start at the root

Back

shell

Front

unix program for interactive session-a text-based user interface

Back

Is the pathmame of every file in a unix filesystem unique?

Front

True

Back

home directory

Front

starting point to login to create files and directory

Back

command to move

Front

mv -moves file from one place to another -renames files

Back

pathname

Front

file includes the file name and the name of the directory that holds the file, and the name of the directory that holds the directory that holds the file, and the name of the... up to the root

Back

What are the rwx of directory?

Front

r - allowed to see the names of the files w - allowed to add and remove files x- gives permission to do standard version of file name and information

Back

Can an entire hierarchy include multiple disk drives?

Front

True (some directories can be on other computers)

Back

How do you use mv to make html

Front

example: mv new.stuff mv new.stuff html

Back

How do you change your current directory?

Front

cd (sometimes used to take you back home/clear)

Back

when logging into unix system, the program you initially interact with is

Front

shell

Back

Unix has to use

Front

verb syntax

Back

Section 2

(45 cards)

command to append

Front

>> things from previous file is destroyed

Back

command to pause

Front

control z

Back

test command

Front

test does a wide variety of test operations; numbers, strings (= !=), files integers: -eq, -ne, -ge, -gt, -lt, -le file: existence, type, empty, readable/write/executable example [ 5 -lt 3 ] //have to have spaces echo $? //gives back 1 bc 5 is not less than 3

Back

example of pipeline command

Front

ps -a | grep seq

Back

How do you throw the output away?

Front

/dev/null

Back

Job Control *

Front

shell allows you to manage jobs -place jobs in background -move a job to foreground -suspend a job -kill a job

Back

show list of patel last names

Front

tail /etc/passwd what it gives back are passwords separated by : //to find/list if there are other patel's grep patel /etc/passwd //to not be case sensitive grep -i patel /etc/passwd

Back

command for information on tasks

Front

jobs

Back

what does putting & at the end of command do?

Front

puts it in background

Back

create file and use cut example

Front

create file prtusers and above grep -i patel etc/passwd | cut -d: -f1,5 > prtusers //below is while loop being able to process one line at a time nano edit prtusers cat prtusers #!/bin/bash grep -i patel etc/passwd | cut -d: -f1,5 | while read line ; do echo "the line just read is:" $line login=$(echo $line | cut -d: -f1) name=$(echo $line | cut -d: -f2) echo " The login is: $login" echo " The name is: $name" done //idk mutt

Back

what is the best for computation

Front

bash arithmetic mode example echo $[5+1] vs expr you have to do expr 5 '+' 1

Back

Can Unix have spaces? *

Front

yes but you should not to make less complicated medicharacter?

Back

grep command

Front

looks for something in a file

Back

create flat file w/ list of receipt item what is the total of the receipt write script where the receipt of standard input will total receipt *

Front

oranges:4:0.89 //take total and multiply so 4x 0.89 //total is 3.56 it would multiply by using bccalculator bc -l 4*3.56 //he said all we need is this #!/bin/bash grep -i patel etc/passwd | cut -d: -f1,5 | while read line ; do echo "the line just read is:" $line login=$(echo $line | cut -d: -f1) name=$(echo $line | cut -d: -f2) echo " The login is: $login" echo " The name is: $name" done

Back

command #!

Front

whatever comes after this should be used to interpret this file (most of the time is a shell) example #!/bin/bash

Back

while

Front

loops until test is false example while <test> ; do [<statements including nested selection/repetition constructs>] done

Back

what do you put if you want 2 commands on the same line?

Front

;

Back

exit code

Front

every program returns exit code generally 0 means ok or true the shell stores the exit code of the last command run in the variable $ ex: grep example true echo $? //returns the exit code example false echo $?

Back

What are some popular shells?

Front

sh Bourne Shell ksh Korn Shell csh C Shell bash Bourne-Again Shell

Back

cut command example

Front

grep -i patel etc/passwd | cut -d: -f1,5 //gives back field 1 and field 5 from Patel dpatel28:Dignesh Patel spatel52:Suraj Patel apatel41:Anuj Patel jpatel31:Jay Patel kpatel39:Krutika Patel

Back

cut

Front

takes delimited flat file and take pieces on information from it with cut you will always have to specify the deliminator -d: deliminator -f field example dpatel28:x:25856:25856:Dignesh Patel:/home/dpatel28:/bin/bash //the name is field 5

Back

Do the contents stay from a cat > or < command?

Front

False have to use append >> bc if not the new content will overwrite example: 2.php has what was in 1.php if use cat > 2.php new new overwrites what was in 2.php

Back

Can you access a file if you do not know the file name?

Front

False

Back

bash arithmetic mode example

Front

c=1 while true; do echo $c c=$[c+1] done //(have to do control c to end) this very fast is good for arithmetic

Back

permissions

Front

r w x octal number 1 1 1 7 1 1 0 6 1 0 1 5 1 0 0 4 0 1 1 3 0 1 0 2 0 0 1 1 0 0 0 0 example 744 giving user all access and rest only read access

Back

option

Front

when argument tells command how to execute example: ls -l

Back

example of expr computation from byron (not good bc slow and spaces etc.)

Front

c=1 while true ; do echo $c c=$(expr $c + 1)//get current value of c and adds 1 to it c=1 while true ; do echo $c c=$(expr $c) //not complete it counted NO

Back

Does forward slash / mean the root directory? Can it be used in a command?

Front

TRUE FALSE

Back

floating point *

Front

bc calculator general purpose has infinite digit calculator (cannot use on default) use bc -l -accepts expressions from standard input example bc -l 1/7 //gives answer

Back

Should shell script you must change its permissions to include eXecute permission for whoever to be able to run

Front

True

Back

for loop syntax

Front

assigns var with each assignment in the list example for <var> in <list>; do [<statements including nested selection/repetition constructs >] done example seq 20 for cnt in $(seq 20) //command execution for cnt in $(seq 20); do echo "The count says" $cnt "ah ah ah" //prints "The count says" number through 20 "ah ah ah"

Back

argument

Front

special parameter that passes information to the command you're running

Back

Command to count how many lines a letter z is on

Front

grep z /etc/passwd | wc -l or man grep grep -c z /etc/passwd

Back

read command

Front

command for input to ask the user to type in line and when pressed enter goes into a variable example read myanswer 15 echo $myanswer //comes back and shows 15 example read -p "What is your answer? " myanswer //says what is your answer? all good //overwrites what myanswer is echo $myanswer //says all good

Back

What is the chmod command?

Front

changes permissions with a file or directory

Back

testable items *

Front

file redirectory file permission numbering and symbolic background and foreground jobs (when command it is normally in foreground and wont get prompt back pauses by control z? jobs command will give all background fg for foreground bg will run in background) ps project status kimp *look at memo bash is shell we use look up how to use bc calculator

Back

redirection

Front

changes default from standard input or standard output symbol is > (output redirection) < (input redirection) (direction of redirection ) example: using command cat to copy input and show output cat > 1.php <?php echo "Hello"; ?> (makes copy of file named 1.php) if used < would take things from 1.php and show print of

Back

The PATH uses what to separate?

Front

colons NO SPACES

Back

Setting shell variable

Front

NO SPACES ALLOWED example: HOME=/etc PATH=/usr/bin:/usr/etc:/sbin NEWVAR="blah blah blah"

Back

if & elif

Front

like using else if example if <test> ; then [<statement including nested selection/repetition constructs>] example [elif <test> ; then [<statement including nested selection/repetition constructs>]]

Back

can you look straight into file?

Front

False have to do conversion of special name in order to do

Back

How to make a shell script

Front

make create/edit a file (zcount) using */ //to create zcount echo 'grep z /etc/passwd | wc -l' > zcount nano zcount //to make sure cat zcount //he used this but idk /* start with #!/bin/bash //marks file saying bash should run it grep z /etc/passwd | wc -l insert permissions using chmod chmod a+xzcount zcount //DONT DO THIS(comes with error) ./zcount //DO THIS says look at recent directory

Back

Can you do 2 cat commands at the same time?

Front

True cat < 1.php > 2.php it supposed to show copy of 1.php and make copy of 2.php from 1.php IT WILL SHOW NOTHING (with input and output command) and 2.php has the same contents of 1.php

Back

pipe command

Front

takes output of one command and sends it to another

Back

command to do word count

Front

wc example wc /etc/passwd7

Back