User Tools

Site Tools


linux:ubuntu:useful-commands

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
linux:ubuntu:useful-commands [2024/02/08 03:18] odeftalinux:ubuntu:useful-commands [2024/02/08 17:12] (current) – [[user] Change mode] odefta
Line 308: Line 308:
 ping -c 4 10.125.50.50 ping -c 4 10.125.50.50
 </code> </code>
-c - number of packets to send (by default in infinite)+c - number of packets to send (by default is infinite)
  
 ===== [ip] Show routing table / find default gateway ===== ===== [ip] Show routing table / find default gateway =====
Line 505: Line 505:
 grep -o 'searched_string' file.txt | wc -l grep -o 'searched_string' file.txt | wc -l
 </code> </code>
-o - print each occurrence on a separate line+o - print each occurrence on a separate line \\ 
 l (from wc) - count lines l (from wc) - count lines
  
Line 518: Line 518:
 grep -nri search workspace/C/ | less grep -nri search workspace/C/ | less
 </code> </code>
-n - show line number +n - show line number \\  
-r - recursive+r - recursive \\ 
 i - case insensitive i - case insensitive
  
Line 759: Line 759:
 ls [abc]*.txt ls [abc]*.txt
 </code> </code>
-[abc] - characters a, b or c +[abc] - characters a, b or c \\  
-* - any number of characters (including 0)+* - any number of characters (including 0) \\ 
 .txt - ends with txt .txt - ends with txt
  
Line 1080: Line 1080:
 echo -e "5\n3\n8\n1" | sort -n echo -e "5\n3\n8\n1" | sort -n
 </code> </code>
-e - interpret escape sequences+e - interpret escape sequences \\ 
 n - numbers (sort as numbers) n - numbers (sort as numbers)
  
Line 1201: Line 1201:
 <code> <code>
 for i in {1..10}; do sleep 3000 & done; pkill sleep for i in {1..10}; do sleep 3000 & done; pkill sleep
 +</code>
 +
 +===== [for] Create 15 files - their names contains numbers =====
 +
 +Using a one-liner, create 15 files with names ranging from final-exam-00.txt to final-exam-15.txt.
 +
 +<code>
 +for i in {0..15}; do touch final-exam-$(printf "%02d" $i).txt; done
 </code> </code>
  
Line 1948: Line 1956:
 </code> </code>
  
-Eliminare read permission for group:+Eliminate read permission for group:
 <code> <code>
 chmod 601 file.txt chmod 601 file.txt
Line 1954: Line 1962:
 </code> </code>
  
-Eliminare write permission for all:+Eliminate write permission for all:
 <code> <code>
 chmod ugo-w file.txt chmod ugo-w file.txt
linux/ubuntu/useful-commands.1707355117.txt.gz · Last modified: 2024/02/08 03:18 by odefta