linux:start

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:start [2020/02/08 12:30] – [Useful shell] mhlinux:start [2022/09/06 12:59] (current) – [Misc Ressources] mh
Line 88: Line 88:
 ---- ----
  
 +===== AppImages =====
 +
 +Extract the content of an AppImage :
 +
 +./your.AppImage --appimage-extract
 +
 +This is useful if you want to get the Icon.
 +
 +[[https://github.com/AppImage/AppImageKit/releases|Link to AppImage Daemon]] //This Daemon scans well known places for appimages and creates menu entries and extracts icons//
 +----
 +
 +===== Grub =====
 +
 +Config file is located at ''/etc/default/grub''
 +
 +The line for a splash image is ''GRUB_BACKGROUND=/path/to/image.jpg''
 +
 +----
 ===== Limit CPU usage ===== ===== Limit CPU usage =====
  
-There are various ways to limit the CPU usage of a process. One simple way is using 'cpulimit'+There are various ways to limit the CPU usage of a process. One simple way is using ''cpulimit''
  
 <code bash> <code bash>
Line 97: Line 115:
  
 [[https://linoxide.com/linux-how-to/limit-cpu-usage-processes-linux/|Ressource site]] [[https://linoxide.com/linux-how-to/limit-cpu-usage-processes-linux/|Ressource site]]
 +----
 ===== Fonts install (bash) ===== ===== Fonts install (bash) =====
  
Line 122: Line 140:
  
 ===== Manipulate pdf ===== ===== Manipulate pdf =====
 +
 +==== Modifying page order ====
  
 Use (<del>pdftk (ubuntu) </del> -> deprecated) or pdf-stapler (fedora) : Use (<del>pdftk (ubuntu) </del> -> deprecated) or pdf-stapler (fedora) :
Line 131: Line 151:
 Old syntax with pdftk : <del>$ pdftk in.pdf cat 3-4 output out.pdf</del> Old syntax with pdftk : <del>$ pdftk in.pdf cat 3-4 output out.pdf</del>
  
-=== Ubuntu ===+=== Ubuntu and derivatives ===
  
 pdfshuffler is a front end for python-pyPdf and a great tool for merging or splitting pdf files with a GUI. pdfshuffler is a front end for python-pyPdf and a great tool for merging or splitting pdf files with a GUI.
 +
 +==== Reducing PDF size ====
 +
 +Found from [[https://askubuntu.com/questions/113544/how-can-i-reduce-the-file-size-of-a-scanned-pdf-file|
 +this answer]] on AskUbuntu :
 +
 +<code bash>
 +gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/ebook -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf
 +</code>
 +
 +''-dPDFSETTINGS'' can be the following : 
 +
 +  *''/screen'' lower quality, smaller size. (72 dpi)
 +  *''/ebook'' for better quality, but slightly larger pdfs. (150 dpi) - __This one gives quite a good ratio of quality-loss/size-reduction__
 +  *''/prepress'' output similar to Acrobat Distiller "Prepress Optimized" setting (300 dpi)
 +  *''/printer'' selects output similar to the Acrobat Distiller "Print Optimized" setting (300 dpi)
 +  *''/default'' selects output intended to be useful across a wide variety of uses, possibly at the expense of a larger output file
 +
  
  
Line 284: Line 322:
 //Note to self : Added "mii" module to the list, the fix didn't seem to hold after reboot. Mii seems to be using r8169 and is network-monitoring-related// //Note to self : Added "mii" module to the list, the fix didn't seem to hold after reboot. Mii seems to be using r8169 and is network-monitoring-related//
  
 +==== Fixing python on youtube-dl ====
 +
 +If following error occurs while using ''youtube-dl'' :
 +
 +<code bash>
 +/usr/bin/env: ‘python’: No such file or directory
 +</code>
 +
 +=== If python3 is not installed ===
 +
 +<code bash>
 +$sudo apt install python3
 +</code>
 +
 +
 +=== If python3 is  installed ===
 +
 +<code bash>
 +$whereis python3
 +$sudo ln -s /usr/bin/python3 /usr/bin/python
 +</code>
 +
 +Change first argument according to where python3 is installed.
 ===== Linux Screencast tools ===== ===== Linux Screencast tools =====
  
Line 292: Line 353:
     *add-apt-repository ppa:maarten-baert/simplescreenrecorder     *add-apt-repository ppa:maarten-baert/simplescreenrecorder
  
 +===== Open VPN =====
 +
 +=== Connecting a client to a remote server ===
 +//This requires a valid .ovpn file//
 +
 +
 +<code>
 +openvpn --config /path/to/file.ovpn
 +</code>
 +
 +[[https://www.linux.com/training-tutorials/configure-linux-clients-connect-openvpn-server/|Linux.com OpenVPN connection tutorial]]
 +
 +=== Connecting to shared folders through openvpn ===
 +//This requires the ip of the shared folders location//
 +
 +===== Samba tips =====
 +
 +=== List available shares on a given host ===
 +Replace host with the hostname or IP address of the server running samba shares
 +<code bash>
 +$ smbclient -L host
 +</code>
 +
 +Output will be something like this 
 +<code>
 + Sharename       Type      Comment
 + ---------       ----      -------
 + home            Disk      
 + shares          Disk      
 + users           Disk      
 + IPC$            IPC       IPC Service ()
 +
 +Reconnecting with SMB1 for workgroup listing.
 +
 + Server               Comment
 + ---------            -------
 +
 + Workgroup            Master
 + ---------            -------
 + MY_WORK              CODE-CA04
 +</code>
 +
 +[[https://www.tldp.org/HOWTO/SMB-HOWTO-8.html|More ressources here]]
 +
 +=== Locate mount points ===
 +
 +Most of the time they are located at ''/run/user/##ID##/gvfs''
 ===== Alias ===== ===== Alias =====
 Create an alias using command  Create an alias using command 
-<code>+<code bash>
 alias name='command' alias name='command'
 </code> </code>
-The alias is only in place while the user session is active. To make it permanent, write it in the .bashrc file in the home directory of the user. ([[http://www.linfo.org/alias.html|more info]])+The alias is only in place while the user session is active. To make it permanent, write it in the ''.bashrc'' file in the home directory of the user. ([[http://www.linfo.org/alias.html|more info]]) 
 + 
 +You can reload the .bashrc file using : 
 + 
 +<code bash> 
 +$ source ~/.bashrc 
 +#or 
 +$ . ~/.bashrc 
 +</code> 
 + 
 +===== Programming Mouse Buttons ===== 
 + 
 +<code bash> 
 +$ sudo apt install xbindkeys xvkbd 
 +$ xev | grep ', button' #Find the buttons you need to map 
 +$ touch ~/.xbindkeysrc 
 +$ nano ~/.xbindkeysrc 
 +</code> 
 + 
 +// Sample File :// 
 + 
 +<code> 
 +# Send enter on thumb mouse button 
 +"xvkbd -text '\r'" 
 +b:8 
 +</code> 
 + 
 +// Ccheck xvkbd for more syntax //
  
 ===== Useful shell ===== ===== Useful shell =====
Line 306: Line 441:
 You can use for commands in the shell or use the 'rename' tool (written in perl). For example : You can use for commands in the shell or use the 'rename' tool (written in perl). For example :
  
-<code>+<code bash>
 skx@lappy:~$ ls skx@lappy:~$ ls
 a.JPG  b.JPG  c.JPG  d.JPG a.JPG  b.JPG  c.JPG  d.JPG
Line 324: Line 459:
 08:21:02 08:21:02
 </code> </code>
 +----
 +
 +=== Mount ===
 +List mounts
 +<code bash>
 +$ findmnt
 +</code>
 +Target disk
 +<code bash>
 +$ sudo fdisk -l
 +Disk /dev/sda
 +[...]
 +Disk /dev/sdb
 +[...]
 +</code>
 +Create mount point
 +<code bash>
 +$ sudo mkdir /media/DRIVE
 +</code>
 +Mount device
 +<code bash>
 +$ sudo mount /dev/sda1 /media/DRIVE
 +</code>
 +Unmount
 +<code bash>
 +$ sudo umount /media/DRIVE
 +</code>
 +[[https://linuxconfig.org/howto-mount-usb-drive-in-linux|More info]]
 ---- ----
  
Line 339: Line 502:
  
 <code bash> <code bash>
-#All the following commands are verbose (-v) +#All the following commands are verbose (-v) and target a file archive (-f
-$ tar -xvf file.tar #Unpack tar +$ tar -xvf file.tar #Unpack tar (-x : extract) 
-$ tar -xvzf file.tar.gz #Unpack compressed (gzip) tar +$ tar -xvzf file.tar.gz #Unpack compressed (gzip) tar (-z : filter through gzip) 
-$ tar -cvf file.tar /path/folder #Pack folder into file.tar archive +$ tar -cvf file.tar /path/folder #Pack folder into file.tar archive (-c : create) 
-$ tar -cvzf file.tar /path/folder #Same as above with compression (gzip)+$ tar -cvzf file.tar /path/folder #Same as above with compression (gzip) (-z : filter through gzip)
 </code> </code>
 +
 +[[https://www.cyberciti.biz/faq/tar-extract-linux/|Extensive Guide]]
 ---- ----
  
 +=== Samba ===
 +
 +<code bash>
 +sudo service smbd start/stop/restart
 +</code>
 +
 +----
 +
 +===== apt and dpkg =====
 +
 +==== Fixing apt dependency problems ====
 +
 +This can fix some states in which apt is broken and refuses to update because some libraries fail :
 +
 +<code bash>
 +$ dpkg --configure -a
 +$ apt --fix-broken install
 +</code>
  
  
 ===== List info ===== ===== List info =====
 +
 +=== Display all information ===
 +
 +<code bash>
 +$ inxi -F
 +</code>
 +//Read the manual, inxi is a very powerful tool to quickly get an overview of a full hardware setup//
  
 === Distrib === === Distrib ===
-<code>+<code bash>
 $ lsb_release -d $ lsb_release -d
 </code> </code>
Line 358: Line 548:
 === CPU === === CPU ===
 Basic Basic
-<code>+<code bash>
 $ lscpu $ lscpu
 </code> </code>
 Detailed, core-specific information, output /proc/cpuinfo Detailed, core-specific information, output /proc/cpuinfo
-<code>+<code bash>
 $ cat /proc/cpuinfo $ cat /proc/cpuinfo
 +</code>
 +
 +On Macs :
 +<code bash>
 +$ sysctl -n machdep.cpu.brand_string
 </code> </code>
  
 === Mounted devices === === Mounted devices ===
-<code>+<code bash>
 $ df -h $ df -h
 </code> </code>
  
 === Kernel === === Kernel ===
-<code>+<code bash>
 $ uname -snrm $ uname -snrm
 </code> </code>
Line 383: Line 578:
  
 === Kernel modules === === Kernel modules ===
-<code>+<code bash>
 $ lsmod $ lsmod
 </code> </code>
  
 === Bash history === === Bash history ===
-<code> +<code bash
-history+history
 </code> </code>
  
 === D-Bus/system bus history === === D-Bus/system bus history ===
-<code> +<code bash
-gdbus +gdbus 
-g-feet //gui history+g-feet //gui history
 </code> </code>
  
  
 +=== Motherboard information ===
 +<code bash>
 +$ sudo dmidecode | grep -A3 ‘^System Information’
 +</code>
 +//dmidecode spurns out a lot of information if you want to query your system//
 +
 +=== Diagnostics & Tools ===
 +
 +<code bash>
 +$ uptime [load Average]
 +$ dmesg -T | tail [Kernel errors]
 +$ vmstat 1 [Virtual memory and detailed information]
 +$ mpstat -P ALL 1 [CPU state]
 +$ pidstat [processes]
 +$ free -m [memory]
 +$ atop [main overview]
 +</code>
 +
 +
 +===== Debug & Logs =====
 +
 +''/var/log/syslog''
 +
 +Check in ''/var/log'' which file was last changed. Use :
 +
 +<code bash>
 +$ls -lart //inverted sorted by time. Last entry is latest modified
 +</code>
 +
 +
 +===== Misc Ressources =====
 +
 +  *[[https://en.wikipedia.org/wiki/Magic_SysRq_key#Configuration|SysRq Keys]] -- Best combo is ''Alt + SysRq + R E I S U B''
 +
 +  *[[https://www.guruadvisor.net/en/software-saas/465-advanced-linux-troubleshooting-methods-and-tools-for-diagnostics-and-problem-identification|Advanced Linux Troubleshooting]]
 +
 +  *[[https://wiki.networksecuritytoolkit.org/nstwiki/index.php?title=HowTo_Create_A_GPT_Disk_With_EFI_System_And_exFAT_Partitions_Using_Parted|Creating GPT/exFAT partitions using CLI]]
  • linux/start.1581161407.txt.gz
  • Last modified: 2020/06/01 16:35
  • (external edit)