Linux Flashcards

1
Q

Create a tree structure recursively

A

Mkdir -p ~/myFile/file/filenote

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How to make a file with out gedit

A

touch filename
Kate fileName
vi fileName (I to insert, shift zz to exit)
Leafpad

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

All the ways to extract a bit of a file

A

sed -n 1~2p
-n line #; p print;
, inclusive range;

head

tail

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How to find info on a specific command

A

man

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Sort switches

A

sort -k 2d fileName

-k column #
2d column #\ data type
Column 2 alphanumeric
3n column 3 numerically

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What does the crontab do?

A

Enables you to regularly schedule reoccurring jobs.

crontab -e

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Join 2 files together column wise

A

Cat&raquo_space; ~/trials/file1
For typing what to add
Cat file1&raquo_space; file2
Joining 2 files

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Know about the calendar

A

cal 05 2017
05 month
2017 year
You can’t specify the day

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How to compress/ uncompress a file

A

Gzip -l file1
(To zip the file)
(Will give it a .gz)
gunzip file1.gz

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How to get the unique files out of a file

A

uniq file one
(To view)
uniq file1 > uniqFile1
(To take out)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

How to count stuff in a file

A

wc file1
(Just one file)
wc file1 file2 file3
(You can do more then one file at a time)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What do the wild cards do

A

*0 or more matching chars in a fileName
?represents a single char
[] A range

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Absolute path and relative path

View the parent of:
/home/student/devices/routers/

A

Absolute:
ls /home/student/devices/

relative:
ls ..

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Create a link to the:

/home/student/inventory

A

ln -s /home/student/inventory /home/student/inventory.bak

Must use absolute path
To unlink:
unlink

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Understand the permissions

A
(-)[---]{---} 11
()file type
[]you
{}group
<>other 
11 # of hard links 
Directory, read, wright, execute, -file
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

How to move files in the tree

A

mv ./file1/file2 ./file1/file3

17
Q

Remove a directory recursively

A

rm -rvi file1

Yes to all

18
Q

Change permissions symbolically

A

Chmod u+r+w+x,g+r+w,o+r file1

19
Q

Change permissions numerically

A

chmod 764 file1

4 read
2write
1 execute
0 fuck all

20
Q

Find file types

A
find -name "*a"/ "a*"
find -cmin 1
find -links 3
find -size 57c
find -type l, f, d
find -user student
21
Q

Make a new user and change there password

A

sudo useradd -m -d /home/user1 user1

Sudo passwd user1
sudo cat shadow

22
Q

Display environment variables

A

env

SHELL=/Bin/bash 
USER=student 
SUDO_COMMAND=/bin/bash 
PWD=/home 
HOME=/home/student
LOGNAME=student 
OLDPWD=/home/student
23
Q

What does the ~ and !~ operators mean

A
~ = matches 
!~ = does not match
24
Q

Joining 2 files together row wise

A

Paste -d file1 file2

Or to make a new file

Paste -d “ “ file1 file2 > file3

25
Q

What do pipes do?

A

The output of the last command becomes the input of the next command

26
Q

Assignment operators

A

Right hand side is evaluated and and assigned to the left hand side; assignHigh to a very low number one you do t expect to hit; assignLow to a really high number one you don’t expect to hit

27
Q

What is a relative path

A

Relative to the default directory

28
Q

What is absolute path

A

Resigns at and includes the system root

29
Q

What is a column and a row?

A

Column is a field

Row is a record

30
Q

Use the history list

A

history for just the 1000

history 5 to specify

31
Q

Scripting place holders

A

%d int
%f float
%s string

%8.2f

32
Q

What are the main ps switches

A
  • a all
  • A all system process
  • al all in long format
33
Q

Proses 1 and 2

A

1 Init

2 Kthread

34
Q

Tar switches

A
Create 
Table of cont 
Xtract 
fileName 
Verbose 
Zip