-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlinux-commands
More file actions
97 lines (50 loc) · 3.28 KB
/
linux-commands
File metadata and controls
97 lines (50 loc) · 3.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
this file contain the linux commands i learned in work. with the day i learned it:
## usefull links:
### Linux tutorial:
https://linuxsurvival.com/linux-tutorial-introduction/
### print commands output to a file:
https://askubuntu.com/questions/420981/how-do-i-save-terminal-output-to-a-file
best option: ** command |& tee output.txt **
Commands:
ls -list all the files in the directory
ls -1: long list of files: with all information of the file
cd “XXX”: go to XXX directory (“/” super parent, “..” parent, “.” current )
cp -r “directory_to_copy” “to_directory” : copy the directory to the directory_to_copy to the directory to_copy
pwd: print working directory
more “file”: show the file content
mv “file” “directory_to_move”: move the file to the directory or change its name
mkdir: make directory
cp “file” “directory_to_copy”: copy the file to the directory
rm “file”: remove the file
rm -r “directory” : remove all the directory tree, with all its files.
rm -rf "directory" : the -f force the remove
rmdir “directory”: remove the directory . only good for empty directory
chmod “u/g/o” “+/-” “file”: change mode for the (user/group/other) to (+/-) of the rwx(read, write, execute) to the file.
chmod 777 <filenam>: each 7 stand for 1 (read) + 2 (write) + 4 (execute). use any combination you need : 3 = 1 (read) + 2 (write)
~ : shortcut for /home/user
Man “command” : open the manual for the command
Finger “name” : find the user name and directory of the name
Find “directory” “what to find (-name/)” “*file_name*” :find file_name by what to find from directory (if file name include wildcard need to worp the name with a quotes (“”))
cat “first_file” “second_file” … “N_file” : concatenate (combine) the files and print them to the screen
cat “first_file” “second_file” > “new_file” : put the two files to a new file
cat “first_file” >> “secode_file” : append the first files to the second file
lpr “file” : print the file in the defult printer
lpr -P “some_printer” “file” : print the file in the some_printer printer
df :present the disc free space
ps aux : process status
cat “file1” “file1” | lpr -P “printer” : the pipe operator | send the output of one command to other command
grep “word_to_find” “file_to_search” : look for all patterns of word in a file
kill “pid” : kill the process with the ipd
kill -9 “pid” : kill immediately the ipd process
echo ‘string’ : output the string resived as an argument. Use as:
echo ‘string’ > new file
touch “file.txt” : create a new file name file in txt format
curl ipv4.ident.me : print my public ip address
__open folder:__ nautilus "folder name" : open the folder with the file manager
__cutting, copy and pasting__ use: ctrl+shift+(x,c,v) (insted of just ctrl+(x,c,v)
# infinite loop that prints the command output to a file.
while true // infinty loop
do
<commands....> // the commands that the loop do every time
sleep 1 // wait between each iterate of the loop
done >> log.txt // redirect the output to a log file