-
Notifications
You must be signed in to change notification settings - Fork 0
/
Commands-Files
82 lines (34 loc) · 1.46 KB
/
Commands-Files
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
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ FILES ]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
chmod 777 filename
[change filename permissions to 777 (there are different # representing different permission levels - Google to find out more)]
------
chown owner-user filename
[Change owner of filename]
------
chown owner-user:owner-group filename
[Change owner and group owner of the filename]
------
chown owner-user:owner-group directory
[Change owner and group owner of the directory]
------
chown -R username:groupname ./*
[Recurrsively change ownership of all files in a current folder to one specified in username and groupname]
------
for file in *; do wc -l $file; done
[Find line count for every file in the current directory]
------
cat file1 > file2
[Save contents of the file into another file]
------
for file in $(cat list.txt); do cp "$file" new_folder; done
[Copy all files found in a list.txt from local folder to a new_folder]
------
ls -lhS
[Show size of all files in current dir in human-readable form and sort them from the largest]
------
find . -type f | rev | cut -d. -f1 | rev | tr '[:upper:]' '[:lower:]' | sort | uniq --count | sort -rn
[list all filetype extensions in the current directory and print it from the most common with number]
------
rm -rfv !("test")
[remove all files and dirs in current directory except for the "test" folder; if does not work enable: "shopt -s extglob", you can disable same with "shopt -u extglob"]
------