cram

studied byStudied by 7 people
5.0(1)
get a hint
hint

Absolute Pathname

1 / 56

Tags & Description

good luck and godspeed

Studying Progress

0%
New cards
57
Still learning
0
Almost done
0
Mastered
0
57 Terms
1
New cards

Absolute Pathname

starts with a slash (/), which represents the root directory. The slash is followed by the name of a file located in the root directory. An absolute pathname can continue, tracing a path through all intermediate directories, to the file identified by the pathname. String all the filenames in the path together, following each directory with a slash (/). This string of filenames is called an absolute pathname because it locates a file absolutely by tracing a path from the root directory to the file.

New cards
2
New cards

Relative Pathname

traces a path from the working directory to a file. The pathname is relative to the working directory. Any pathname that does not begin with the root directory (represented by /) or a tilde (~) is a relative pathname

New cards
3
New cards

3 ways to return to your home directory

cd ~, cd, cd $HOME

New cards
4
New cards

What‘s the arrangement of directories and files in the unix system?

a tree-like structure called the file system, called a directory tree. At the very top of the file system is a directory called “root” which is represented by a “/”. All other files are “descendants” of root.

New cards
5
New cards

What directory does it take you to when you first log in?

The home directory.

New cards
6
New cards

What’s the command that gives helpful information on a utility?

man (eg: ‘man cat’ will display a manual on the cat utility)

New cards
7
New cards

What symbol do hidden files in a directory start with?

dot character (.)

New cards
8
New cards

What’s the command that tells you the current name of the shell?

echo $0 (returns -bash)

New cards
9
New cards

Set a variable value in a borne shell. How do you display the variable?

echo $variname

New cards
10
New cards

What does echo $PATH display?

Which directories your shell is set to check for executable files. $PATH is the list of said directories.

New cards
11
New cards

What is the command and option that lets you see all the meta information of a file?

ls -l filename

New cards
12
New cards

Inside a borne shell script, what’s the symbol used for the PID?

$$

New cards
13
New cards

What’s the command that can be used to change permission information for a file?

chmod

syntax: chmod a+r filename (makes filename readable to all)

New cards
14
New cards

What’s the command that copies files?

cp

syntax: cp ogfile copyfile

New cards
15
New cards

What’s the command that is used to tell the type information of a file?

file

eg: file filename (displays filename: ASCII text)

New cards
16
New cards

What’s the command used on a file to display one page of information of the file contents at a time?

more or less (less allows you to scroll up, more does not)

eg: cat filename | less

New cards
17
New cards

What’s the command to make soft links?

ln -s filename linkname

Allows multiple filenames to be linked to a file

New cards
18
New cards

What’s the command that outputs the contents of a text file?

cat filename

New cards
19
New cards

What’s the command that searches for patterns in a text file?

grep string filename

New cards
20
New cards

Basic redirection syntax.

cat >  filename

Create a file called filename. Type the desired input and press CTRL+D to finish. The text will be in file filename.

cat < filename

Just cats the content of filename.

New cards
21
New cards

What is the command that makes a new subdirectory/directory?

Mkdir dirName

New cards
22
New cards

What’s the command that removes a file? Moves a file?

rm filename

mv filename newfile

New cards
23
New cards

What’s the command that displays the information about the users logged into the system?

who

New cards
24
New cards

What’s the command that deletes a non-empty directory?

rmdir or rm -d

New cards
25
New cards

If I touch a file name, and the file name doesn't already exist, does touch create it?

Yes, touch creates an empty file.

New cards
26
New cards

If you set the variable value in the shell and you want a program/script to read and display it, what command do you have to do on the variable to make it available to the script?

export

New cards
27
New cards

How do you read in a value in a shell prompt?

<p>read</p>

read

<p>read</p>
New cards
28
New cards

What does the command “find” do? find -name?

<p>used to find files and directories and perform subsequent operations on them. It supports searching by file, folder, name, creation date, modification date, owner and permissions.</p><p></p><p>find -name searches filenames specifically.</p>

used to find files and directories and perform subsequent operations on them. It supports searching by file, folder, name, creation date, modification date, owner and permissions.

find -name searches filenames specifically.

<p>used to find files and directories and perform subsequent operations on them. It supports searching by file, folder, name, creation date, modification date, owner and permissions.</p><p></p><p>find -name searches filenames specifically.</p>
New cards
29
New cards

What is the command to list all the files in your working directory that start with a dot?

ls -a lists all files including hidden files that start with a dot. do not try ls .* it broke my thing

New cards
30
New cards

Metacharacter for pipe?

|

New cards
31
New cards

Which key stroke will enter command mode in VIM?

esc

New cards
32
New cards

in VIM, which keystroke will allow you to enter editor mode?

i

New cards
33
New cards

What mode is VIM in at first?

command mode

New cards
34
New cards

Command to write (save) the contents of the files then quit the editor?

esc :wq!

New cards
35
New cards

What symbols do commands start with in VIM?

:

New cards
36
New cards

Can you chmod a file you don’t own?

No

New cards
37
New cards

Can you list metadata on files you don’t own?

Yes

New cards
38
New cards

What is a root?

A user that can do anything (ex: chmod any file)

New cards
39
New cards

What does touching an already existing file do? Does it reset it’s permissions?

if the file existed beforehand, touch will not change its permissions, just update its last edited timestamps

New cards
40
New cards

What is a token?

A non blank character/sequences of characters

\
A token is made up of ordinary characters, or of operator characters ()<>&|;, but not both. For example, foo
New cards
41
New cards

What symbol do options start with?

-

New cards
42
New cards

Identify commands with 0 arguments.

cd, pwd

New cards
43
New cards

What is an example of a built-in command?

echo, cd

New cards
44
New cards

How do you do piping?

A pipe is a form of redirection (transfer of standard output to some other destination). Allows you to use 2 commands at once

ex: history | tail

calls history command and tail to display the last 10 executed commands

New cards
45
New cards

What’s the comments you need on the first line of the script to ensure it gets executed on the bash shell?

#!/bin/bash

New cards
46
New cards

What are the 2 metasymbols you have to put at the beginning of a script for it to run correctly?

./

New cards
47
New cards

What’s the syntax for creating an alias?

alias ‘someAlias=someCommand’

New cards
48
New cards

What does grep do? Syntax?

Identifies line with requested string.

grep “l” filename

works on directories to search file names

New cards
49
New cards

Which file do you save variables, functions, and aliases to so they are available upon log in?

In the ~/.bashrc file

New cards
50
New cards

What are the single dot and double dot directory entries?

mkdir automatically adds these 2 entries.

The . is synonymous with the pathname of the-working directory and can be used in its place; the .. is synonymous with the pathname of the parent of the working directory. These entries are hidden because their filenames begin with a period.

New cards
51
New cards

num=875

number1=”Add $num”

number2=’Add $num’

What will echo $number1 and echo $number2 display?

Add 875

Add $num

New cards
52
New cards

ls -l info idk just memorize this

knowt flashcard image
knowt flashcard image
New cards
53
New cards

chmod symbols (just memorize this too)

knowt flashcard image
knowt flashcard image
New cards
54
New cards

Do I have to put symbols in front of a function name to run it or can I just put the name of the function?

Just name of function.

New cards
55
New cards

What is the shell metacharacter that matches 0 or more characters?

*

New cards
56
New cards

What is the shell metacharacter that matches 1 character?

?

New cards
57
New cards

Inside a script, what are the symbols that contain the arguments on the command line to the script?

$1, $2, … , $n for each argument n on the command line

New cards

Explore top notes

note Note
studied byStudied by 50 people
Updated ... ago
4.5 Stars(2)
note Note
studied byStudied by 10 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 6 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 34 people
Updated ... ago
5.0 Stars(3)
note Note
studied byStudied by 8 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 81 people
Updated ... ago
4.0 Stars(1)
note Note
studied byStudied by 18 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 16543 people
Updated ... ago
4.5 Stars(11)

Explore top flashcards

flashcards Flashcard39 terms
studied byStudied by 7 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard94 terms
studied byStudied by 55 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard97 terms
studied byStudied by 12 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard50 terms
studied byStudied by 28 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard66 terms
studied byStudied by 1 person
Updated ... ago
5.0 Stars(1)
flashcards Flashcard58 terms
studied byStudied by 20 people
Updated ... ago
5.0 Stars(2)
flashcards Flashcard30 terms
studied byStudied by 2 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard62 terms
studied byStudied by 9 people
Updated ... ago
5.0 Stars(2)