Linux Flashcards
Create a tree structure recursively
Mkdir -p ~/myFile/file/filenote
How to make a file with out gedit
touch filename
Kate fileName
vi fileName (I to insert, shift zz to exit)
Leafpad
All the ways to extract a bit of a file
sed -n 1~2p
-n line #; p print;
, inclusive range;
head
tail
How to find info on a specific command
man
Sort switches
sort -k 2d fileName
-k column #
2d column #\ data type
Column 2 alphanumeric
3n column 3 numerically
What does the crontab do?
Enables you to regularly schedule reoccurring jobs.
crontab -e
Join 2 files together column wise
Cat»_space; ~/trials/file1
For typing what to add
Cat file1»_space; file2
Joining 2 files
Know about the calendar
cal 05 2017
05 month
2017 year
You can’t specify the day
How to compress/ uncompress a file
Gzip -l file1
(To zip the file)
(Will give it a .gz)
gunzip file1.gz
How to get the unique files out of a file
uniq file one
(To view)
uniq file1 > uniqFile1
(To take out)
How to count stuff in a file
wc file1
(Just one file)
wc file1 file2 file3
(You can do more then one file at a time)
What do the wild cards do
*0 or more matching chars in a fileName
?represents a single char
[] A range
Absolute path and relative path
View the parent of:
/home/student/devices/routers/
Absolute:
ls /home/student/devices/
relative:
ls ..
Create a link to the:
/home/student/inventory
ln -s /home/student/inventory /home/student/inventory.bak
Must use absolute path
To unlink:
unlink
Understand the permissions
(-)[---]{---} 11 ()file type []you {}group <>other 11 # of hard links Directory, read, wright, execute, -file
How to move files in the tree
mv ./file1/file2 ./file1/file3
Remove a directory recursively
rm -rvi file1
Yes to all
Change permissions symbolically
Chmod u+r+w+x,g+r+w,o+r file1
Change permissions numerically
chmod 764 file1
4 read
2write
1 execute
0 fuck all
Find file types
find -name "*a"/ "a*" find -cmin 1 find -links 3 find -size 57c find -type l, f, d find -user student
Make a new user and change there password
sudo useradd -m -d /home/user1 user1
Sudo passwd user1
sudo cat shadow
Display environment variables
env
SHELL=/Bin/bash USER=student SUDO_COMMAND=/bin/bash PWD=/home HOME=/home/student LOGNAME=student OLDPWD=/home/student
What does the ~ and !~ operators mean
~ = matches !~ = does not match
Joining 2 files together row wise
Paste -d file1 file2
Or to make a new file
Paste -d “ “ file1 file2 > file3
What do pipes do?
The output of the last command becomes the input of the next command
Assignment operators
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
What is a relative path
Relative to the default directory
What is absolute path
Resigns at and includes the system root
What is a column and a row?
Column is a field
Row is a record
Use the history list
history for just the 1000
history 5 to specify
Scripting place holders
%d int
%f float
%s string
%8.2f
What are the main ps switches
- a all
- A all system process
- al all in long format
Proses 1 and 2
1 Init
2 Kthread
Tar switches
Create Table of cont Xtract fileName Verbose Zip