linux:linux-commands

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
linux:linux-commands [2018/08/01 19:59] – 108.225.197.92linux:linux-commands [2019/11/07 14:58] (current) – 12.29.70.125
Line 90: Line 90:
  
 <code>sudo dhclient eno1</code> - Windows equivalent of dhcp release / renew <code>sudo dhclient eno1</code> - Windows equivalent of dhcp release / renew
 +
 +<code>sudo dhclient eno1 down</code>
 +<code>sudo dhclient eno1 up</code>
  
 ===== MySQL Commands ===== ===== MySQL Commands =====
Line 228: Line 231:
 <code>echo ''; sar -q -f /var/log/sa/sa01 | grep -E '[1-9]+[0-9]*[0-9]*\...' | awk -v fifteen=' 15 Minute Load Avg' '{print $1, $2, $7, fifteen}'; echo ''</code> - (Prints just the 15 minute load average) <code>echo ''; sar -q -f /var/log/sa/sa01 | grep -E '[1-9]+[0-9]*[0-9]*\...' | awk -v fifteen=' 15 Minute Load Avg' '{print $1, $2, $7, fifteen}'; echo ''</code> - (Prints just the 15 minute load average)
  
 +===== Date and time =====
 +[[https://www.howtogeek.com/410442/how-to-display-the-date-and-time-in-the-linux-terminal-and-use-it-in-bash-scripts/]]
  
 =====  Restart Services ===== =====  Restart Services =====
Line 241: Line 246:
 =====  Hardware Information / Software Information ===== =====  Hardware Information / Software Information =====
  
-<code>uname a </code> +<code>env | grep '^DESKTOP_SESSION' | cut -d'=' -f2-</code> 
-- Find out what version of linux you are running +- will print 'ubuntu' 
 + 
 +<code>uname -r</code> 
 +- kernel version [kernel version, major, minor, bug-fix, distribution (generic)] 
 + 
 +<code>uname -a</code> 
 +- sysinfo [linux, hostname, kernel release, ubuntu compiled time, machine arch, processor arch, OS arch, GNU/Linux] 
 + 
 +<code>cat /proc/version</code> 
 +- similar to uname -a 
 + 
 +<code>dmesg | grep Linux</code> 
 +- similar to uname -a 
 <code>cat /etc/*-release</code> <code>cat /etc/*-release</code>
  
Line 395: Line 413:
  
 ===== Helpful git script ===== ===== Helpful git script =====
 +Run the following from the parent directory, ''plugins'' in this case:
 +
 +<code>
 +find . -type d -depth 1 -exec git --git-dir={}/.git --work-tree=$PWD/{} pull origin master \;
 +</code>
 +
 +To clarify:
 +
 +  * ''find .'' searches the current directory
 +  * ''-type d'' to find directories, not files
 +  * ''-depth 1'' for a maximum depth of one sub-directory
 +  * ''-exec {} \;'' runs a custom command for every find
 +  * ''git --git-dir={}/.git --work-tree=$PWD%%/{%%} pull'' git pulls the individual directories
 +
 +To play around with find, I recommend using ''echo'' after ''-exec'' to preview, e.g.:
 +
 +<code>
 +find . -type d -depth 1 -exec echo git --git-dir={}/.git --work-tree=$PWD/{} status \;
 +</code>
 +
 +Note: if the ''-depth 1'' option is not available, try ''-mindepth 1 -maxdepth 1''.
 +
 <code> <code>
 find . -type d -depth 1 -exec git --git-dir={}/.git --work-tree=$PWD/{} pull origin master \; find . -type d -depth 1 -exec git --git-dir={}/.git --work-tree=$PWD/{} pull origin master \;
Line 401: Line 441:
 </code> </code>
 - for updating multiple git repos in the current folder - for updating multiple git repos in the current folder
 +
 +===== How to kill a process in linux =====
 +<code>ps aux</code>
 +- use this to list all of the current running processes
 +<code>ps aux | grep "chrome"</code>
 +- use this to search the processes for "chrome"
 +<code>
 +USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
 +root         1  0.0  0.0 193540  9780 ?        Ss   May16   3:24 /sbin/init splash
 +root         2  0.0  0.0      0     0 ?        S    May16   0:00 [kthreadd]
 +root         3  0.0  0.0      0     0 ?        I<   May16   0:00 [rcu_gp]
 +root         4  0.0  0.0      0     0 ?        I<   May16   0:00 [rcu_par_gp]
 +root         6  0.0  0.0      0     0 ?        I<   May16   0:00 [kworker/0:0H-kblockd]
 +</code>
 +- output looks like this
 +<code>kill -9 [pid]</code>
 +- use this to kill the process, the ''-9'' will kill all processes that it can kill, including the tree
 +
 +===== Linux Time =====
 +<code>
 +timedatectl set-local-rtc 1 --adjust-system-clock
 +timedatectl
 +timedatectl set-local-rtc 0 --adjust-system-clock
 +</code>
 +- use the first command to set linux to use local time, use the second command to check the settings for time, and use the third command to return it to default
  • linux/linux-commands.1533153595.txt.gz
  • Last modified: 2018/08/01 19:59
  • by 108.225.197.92