1. how to unzip files zipped with the AES encryption
  2. In April 2023 when trying to use unzip on a *.zip file I encountered the following message:

    $ unzip staging-2023-cred.zip 
    Archive:  staging-2023-cred.zip
       skipping: staging-2023-cred.txt   unsupported compression method 99
    
    It turns out that my unzip program was unable to unzip the archive as it used the Adavanced Encryption Standard (AES) encryption, which is not supported by unzip, at least not in the version I was using:
    $ unzip -v
    UnZip 6.00 of 20 April 2009, by Debian. Original by Info-ZIP.
    
    After some googling I realized I had to install the 7zip package which supports AES encryption:
    $ sudo apt update
    $ sudo apt install p7zip-full p7zip-rar
    
    … following the above, I was able to unzip using:
    $ 7z e staging-2023-cred.zip
    
    Note that the archive was password-protected and I was prompted for the password by the 7z program.

  3. recursively change modification timestamp in a set of files
  4.  for f in $(find some-dir/); do  sudo touch -a -m -t 202303062145.32 $f; done
    NB: the above procedure will NOT modify the "change date" of the file (ctime). The status change timestamp is shown with the stat command and is, by design, impossible to change. The only way to accomplish this would be to change the time in the entire system. See: here.
  5. overwrite modification timestamps when creating a tarball
  6. tar -cvf boo-2023-03-06.tar --sort=name --mtime='UTC 2023-03-06' boo/ 
    source
  7. find files and sort based on modification time
  8. find src -regex '.*-func.tsx' -printf "%T@ %Tc %p\n" | sort -n

    — or, to search all non-directories, use:
    find src/components/ ! -type d -printf "%T@ %Tc %p\n" | sort -n
  9. looping through files with spaces in names
  10. I've successfully used the following script (source):

    find . -type f -name "*.csv" -print0 | while IFS= read -r -d '' file; do
        echo "file = $file"
        diff "$file" "/some/other/path/$file"
        read line </dev/tty
    done
    

  11. format output to a specific line length
  12. source
    fold -s -w80 /some/file
  13. continuous work approach
  14. while inotifywait -e close_write contract.tex; do make; done
  15. remove metadata from PNG (and other) image files
  16. source

    The following command removes all metadata:

    $ exiftool -all= foo.png

    The following command displays metadata (notice the missing equals sign)

    $ exiftool -all foo.png

    One can also use the mogrify program:

    mogrify -strip foo.png

  17. rotate and resize PDF
  18. source

    The program pdfjam is installed with:

    sudo apt install texlive-extra-utils

    I then did:

    pdfjam --paper a4paper --angle 90 some-file.pdf

  19. ultra-useful script for reducing the size of PDF files by lowering resolution
  20. find . -iname \*.pdf -exec gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dNOPAUSE -dQUIET -dBATCH -sOutputFile='{}.2.pdf' '{}' \; -exec mv '{}.2.pdf' '{}' \; 

    NB: I have not found a way to specify a custom resolution that would be lower to that of /screen

    sources:

    1. https://askubuntu.com/a/256449
    2. https://stackoverflow.com/a/6043896

  21. useful programs for examining / comparing binary files
  22. hexdump, cmp and the hexl-mode of emacs

  23. how I downloaded files from my Android phone to Ubuntu
  24. I installed the FileManager+ application on my Android device which has an option "Access from network" which I then used to download the files to my machine using the filezilla program. I tried the command-line version of ftp but it didn't support wildcards. Also, FTP support has been removed from Chrome so that wasn't an option either. Filezilla worked like a charm.

    On AM's Android device I couldn't find FileManager+ to install on the app store (only on dangerous 3rd party stores) so I installed (from the app store) the WiFi File Explorer app which offered a similar FTP functionality.

    update 2022-08-31. In August 2022 I used the same method with similar success on my Ubuntu 20.04 machine. I also note that, for some reason, Firefox too (besides Chrome) failed to open the FTP link. In any case, Filezilla delivered.

  25. concatenate PDFs (much simpler method)
  26. pdftk pg1.pdf pg2.pdf cat output all.pdf
  27. dead simple HTTP server
  28. source

    python3 -m http.server
    It should will serve whatever's in the CWD (e.g. index.html) at http://0.0.0.0:8000.

  29. concatenate / merge multiple PDF into a single one
  30. NB: see simpler way above
    source 1 source 2
    I 've used the following:

    convert -density 300x300 -quality 100 1.pdf 2.pdf merged.pdf
    After I was hit with:
    convert: not authorized `*.pdf' @ error/constitute.c/ReadImage/412.
    I modified file
    /etc/ImageMagick-6/policy.xml
    as follows:
    <   <policy domain="coder" rights="none" pattern="PDF" />
    ---
    >   <policy domain="coder" rights="read|write" pattern="PDF" />
            

  31. analyze PDF document for malicious code
  32. Starting off from https://security.stackexchange.com/a/2897/131157 I used the following two programs:

  33. test mouse for click problems in Ubuntu
  34. xev | awk '/ButtonRelease/ {print $1, i++}'
  35. play music CDs from the command line
  36. mplayer -cdrom-device /dev/sr0 cdda://
  37. decrypting PDF files
  38. source

    On 2019-03-08 I used the qpdf tool as described in the source:

    sudo apt-get install qpdf
    qpdf –password=password –decrypt /home/lori/Documents/secured.pdf /home/lori/Documents/unsecured.pdf
            
    … it worked like a charm.

    NB: I encountered problems when trying to use the other approach suggested in the same source, namely that of using pdftk:

    $ pdftk ~/Downloads/plan-to-conquer-the-world.pdf input_pw superdupersecretpwd output foo.pdf
    Error: Unexpected Exception in open_reader()
    Unhandled Java Exception in main():
    java.lang.NullPointerException
       at gnu.gcj.runtime.NameFinder.lookup(libgcj.so.16)
       at java.lang.Throwable.getStackTrace(libgcj.so.16)
       at java.lang.Throwable.stackTraceString(libgcj.so.16)
       at java.lang.Throwable.printStackTrace(libgcj.so.16)
       at java.lang.Throwable.printStackTrace(libgcj.so.16)
            

  39. convert audible *.aax files to *.mp3 in Linux
  40. getting a window's PID by clicking on it
  41. xprop _NET_WM_PID | cut -d' ' -f3
    {click on window}
    source
  42. how to copy Audio CD in Ubuntu
  43. Install the awesome K3B (KDE Burning Tool) - much better than Brasero which has given me a lot of grief. The below worked like a charm in my 32-bit Ubuntu 12.04.5 LTS on July 2017.

    $ sudo apt-get install k3b -y --force-yes

    Launch with:

    $ k3b

  44. how to extract a slice out of an mp3 file without re-encoding (which might lead to quality degradation)
  45. ffmpeg -i long-boring-cd.mp3 -vn -acodec copy -ss 00:00:00 -t 00:03:03 my-favourite-track.mp3
  46. alsamixer settings
  47. Most of the alsamixer settings are about the microphones. Most of the settings are about the microphones But the PCM (Pulse Code Modulation) gain control effectively controls the volume.

    Pulse Code Modulation (PCM) is the primary way analog audio signals are converted into digital form by taking samples of the waveforms from 8 to 192 thousand times per second (8 to 192 kHz) and recording each sample as a digital number from 8 to 24 bits long (seesampling). PCM data are pure digital audio samples, and they are the underlying data in several music file formats (see WAV, FLAC and AIFF).

    The audio-out port on a sound card provides an analog signal to the speakers; however, compressed formats such as MP3 and AAC are converted to PCM, and the PCM data are converted to analog (see D/A converter). Sound cards may also output PCM and other digital signals such as Dolby Digital (see S/PDIF). With regard to input, an analog microphone is plugged into the audio-in port, and the sound card converts the analog signals to PCM.

  48. sound issues in Ubuntu 16.04
  49. I recently (Autumn 2017) lost sound in two separate occassions, on two separate machines (Ubuntu 14.04 and Ubuntu 16.04). I managed to restore sound with the following two methods:

    In both cases I tried playing with the alsamixer dB gains settings but that didn't fix my problem.

    To verify the solutions I used:

    play /usr/share/sounds/alsa/Front_Center.wav

  50. how to encrypt PDF files in Ubuntu
  51. (source) — the following worked on Ubuntu 16.04 in 2017:
    sudo apt install pdftk
    pdftk ~/Downloads/mp.pdf output ~/Downloads/mp-encrypted.pdf owner_pw changeme user_pw changeme2
    The above incantation purposefully disallows printing the document. The owner and user passwords have to differ (I am not super-clear on the nuances).
  52. install Graphviz in Ubuntu 16.04
  53. how I managed to solve the dreaded suspend / resume failure on my Dell Precision M3800 laptop running Ubuntu 14.04 or 16.04
  54. install Chrome in Ubuntu 16.04
  55. synopsis:

    Download the package and install it force-installing the dependencies:

    sudo dpkg -i --force-depends google-chrome-stable_current_amd64.deb
            

    In case any dependencies didn't install (you would have a warning or failure message for this), you can force them via:

    sudo apt-get install -f
    

  56. Ubuntu 14.04 how to set sound levels on the command line
  57. source

    Increase volume by 5%

    amixer -D pulse sset Master 5%+
            

    Decrease volume by 5%

    amixer -D pulse sset Master 5%-
            

    Set volume to 50%

    amixer -D pulse sset Master 50%
            

    NB: Under i3wm I have binded the above commands to my laptop volume control keys. The bindings live in the ~/.config/i3/config file (on my Precision machine).

  58. how to install Skype on Ubuntu 14.04 64bit LTS
  59. The installation was eventfull — I ended up using the following links:

    1. installation instructions
    2. post-installation library problem fix — step 1
    3. post-installation library problem fix — step 2

    … I ended up adding the following line:
    alias skype='LD_PRELOAD=/usr/lib/i386-linux-gnu/me‌​sa/libGL.so.1 skype'
    … in the .bashrc_thisnode file for the Dell Precision laptop (where I am running Unbuntu 14.04 LTS 64 bit).

  60. how to merge multiple JPG or PNG files into a PDF file
  61. Use convert (source) to, e.g. do a:
    convert diploma-transcript-greek-pg1-col.jpg diploma-transcript-greek-pg2-col.jpg diploma-transcript-greek-full-size.pdf

    To control page size and background color you can do:

    convert IMG_20190331_143038.jpg IMG_20190331_143055.jpg IMG_20190331_143110.jpg -background white -page a4 plot-signed.pdf

    Following the conversion you may wish to compress the resultant PDF file.

    update When the files (e.g. PNG) are not already A4-sized I have also successfully used the below incantation:

    i=150; convert dell-stuff-pg1.png dell-stuff-pg2.png dell-stuff-pg3.png -resize $(echo ${i}*8.27 | bc)x$(echo ${i}*11.69 | bc) -density ${i}x${i} -repage $(echo ${i}*8.27 | bc)x$(echo ${i}*11.69 | bc) dell-stuff.pdf
            
    … based on this answer.

  62. how to compress a PDF file
  63. source
    gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf
    If the /screen option results in too low quality, try /ebook instead.
  64. how to test what a site looks like from various other world-wide locations
  65. Use geopeeker.com.
  66. test network speed
  67. The speedtest.net web site can be used to test upload and download speed to any geographical region of the world.
  68. how to dump specific bytes of a binary file in a human-readable format
  69. Use dd and pipe the output to either xxd or hexdump.
    $ dd if=sample-rapid-file ibs=1 skip=164 count=20 2>/dev/null | xxd -b
    0000000: 00000000 00000000 00000000 10111101 00000000 00000000  ......
    0000006: 00000000 00000000 00000000 00000000 00000000 00000001  ......
    000000c: 00000000 00000000 00000000 00000000 00000000 00000000  ......
    0000012: 00000000 00000000                                      ..
          

    ... or:
    $ dd if=sample-rapid-file ibs=1 skip=164 count=20 2>/dev/null | hexdump -C
    00000000  00 00 00 bd 00 00 00 00  00 00 00 01 00 00 00 00  |................|
    00000010  00 00 00 00                                       |....|
    00000014
          
  70. how to output the binary representation of a file
  71. xxd -bp sample.dat | head -3
          
  72. capture a window with a fused delay of 10 seconds
  73. This is useful when wanting to also capture a context popup menu (e.g. as typically launched by a right mouse click).
    $ gnome-screenshot -w -d 10

    Also:
    gnome-screenshot --interactive
  74. Hex editor for the shell
  75. Emacs has the hexl-mode for hexadecimal viewing/editing.
  76. infinite loop in bash; and break on problem
  77. while true; do ./valgraph-harvest-wrongsets-last-30-days-html; if [[ $? != 0 ]]; then break ; fi ; done
          
  78. proper way to encode a string in MD5 using md5sum
  79. Simply doing a:
    echo "password" | md5sum
          
    ... will not work as the shell also insidiously suffixes an end-of-line character.
    Either of the two ways have to be used instead:
    $ echo -n password | md5sum
    5f4dcc3b5aa765d61d8327deb882cf99  -
    $ printf '%s' "password" | md5sum
    5f4dcc3b5aa765d61d8327deb882cf99  -
          

    The insidious suffixing of an end-of-line character can be confirmed with the following:
    printf '%s\n' "password" | md5sum
          
  80. how to customize Conkeror with your own default key-bindings
  81. The instructions I found most useful are here. Also this page contains examples of using the define_key function which I found useful and actually used.
    My own Conkeror customizations are under git in ~/environment/.conkerorrc/ and they of course have to be symlinked from home:
    cd
    ln -s environment/.conkerorrc/
          

    ... in order for Conkeror to pick them up.
  82. how to install Conkeror in Ubuntu (again, latest approach)
  83. On 15.IX.2014 I used the following approach to install Conkeror: The source was this answer
  84. install the apt repository for Nightly built Conkeror Debian Pakcages
  85. source
    Add the following lines to your /etc/apt/sources.list (for Wheezy as in my system that's what cat /etc/debian_version shows):
    deb     http://noone.org/conkeror-nightly-debs wheezy main
    deb-src http://noone.org/conkeror-nightly-debs wheezy main
          

    Then add the latest key to your APT key ring without verfication, just execute the following as root:
    apt-key adv --keyserver pgp.uni-mainz.de --recv-keys 0F84088E
          
  86. Install the conkeror packages
  87. source
    sudo apt-get udpate
    sudo apt-get install conkeror conkeror-spawn-process-helper
          
  88. finally, rely on the (already existing by now) conkeror script and Dash integration using alacarte as described in the alternative instructions (used in the past) below
  89. convert PDF to PNG high-quality
  90. The below seems to give good results (source):
    convert -density 300 cds-oai-dc-problem.pdf -trim -quality 100  cds-oai-dc-problem.png
            
    By passing -trim as an option we also get rid of a subsequent trimming step.
  91. command line to convert a PDF file to PNG in Ubuntu
  92. convert database-high-level.pdf -background White -flatten database-high-level.png
            
    (the above incantation also replaces the transparent background with white background)
  93. trim PNG images in Ubuntu
  94. Use the trim command of the convert program from the ImageMagick package:
    convert input.png -trim output.png
            
  95. meld alternative (that also supports comparisons among more than 2 files)
  96. sudo apt-get install diffuse
  97. install DbVisualizer 9.1 in Ubuntu
  98. In the past I had some successes with the Linux x86 setup installer you can get from here, but today I failed repeatedly to get it to properly install using that script, so in the end I just downloaded the UNIX tar.gz archive (from the same location), exploded it locally and then added dbvis on the launchpad Dash using alacarte. I then searched my gmail for the dbvis.license key I have.
  99. add an arbitrary application to the Ubuntu Dash overlay of the launchpad
  100. Use alacarte. Info here.
  101. compare files in current directory only with those of another directory
  102. way 1
    The below way uses the snapshot_dir as the reference directory, so if a file is missing there it is not compared.
        for f in $(find snapshot_dir -maxdepth 1 -type f -iname \*.xsd -o -iname \*.dtd) ; do diff `basename $f` $f ; done
            

    way 2
    The below way uses the local_dir as the reference directory, so if a file is missing there is is not compared.
        for f in $(find . -maxdepth 1 -type f -iname \*.xsd -o -iname \*.dtd) ; do diff $f snapshot_dir/$f ; done
            
    I suppose the most rigorous check is combining both ways in a single script.
  103. how to install Conkeror in Ubuntu
  104. Original link here. Four steps:

    1. instal xulrunner
    2. follow top answer here.

      Note that for some reason the sudo sh -c "wget -O- $XURL | tar -xj" command didn't work for me and I had to manually download $XURL (in my case it was this link), and then do a:

      sudo cat ~/Downloads/xulrunner-23.0.en-US.linux-i686.tar.bz2 | sudo tar -xj
    3. install Conkeror
    4. For that, I didn't follow my earlier routine (described here), but rather I simply cloned Conkeror's git repository:
      git clone http://repo.or.cz/r/conkeror.git
    5. preapare a conkeror script
    6. In my case, that script I prepared (based on instructions found here resides in the ~tools git repository.
    7. add the script to the Dash using alacarte
    8. Instructions here.

  105. how to open up a terminal in any folder of the file browser
  106. sudo apt-get install nautilus-open-terminal

    then, right-clicking on a folder shows option "Open in Terminal" (a log-off / log-in cycle may be necessary)
  107. how to install bd (quickly go back to a specfic parent directory)
  108. Original link:
    here.

    (I 've downloaded it at ~/tools, so I it's not on /usr/bin/bd)
  109. get diff (esp. a recursive one) to produce very summarized output
  110. Pipe the output of diff to diffstat
  111. find out quickly the amount of memory recognized by the system
  112. free -mt
  113. find out if the Linux version and/or the hardware support PAE (Physical Address Extension)
  114. This is determined by searching for the string 'pae' in the output of the following programs, for the OS and the hardware, respectively:
    uname -a | grep pae
    grep --color=always -i PAE /proc/cpuinfo
  115. show system specs in Ubuntu
  116. There are many ways:
    sudo lshw
    sudo lshw -html > myspecs.html
    sysinfo
    htop
  117. how to find which process binds on specific ports
  118. sudo netstat -tulpn 
    and then, once you have the PID (e.g. 3903), you can do a:
            ls -l /proc/3903/exe
            cat /proc/3903/cmdline
            ls -l /proc/3903/cwd 
    ... to find more about the process.
  119. pattern to use when in need to replace broken links in a systematic way:
  120. find . -iname \*.jar | while read ANS;
        do DIR=$(dirname "$ANS");
        cd "$DIR";
        rm $(basename "$ANS"); 
        ln -s ../../../../../../../../repo-wide-libs/$(basename "$ANS");
    done
          
  121. interesting tar incantation
  122. tar jcpf archive-name.tar.bz2 www/{folderA,folderB} 
  123. report total disk usage of directory
  124. du -s
    Also, -b to report bytes and -h for human-readable.
  125. cleanse hash table info of the shell as to the location of executables
  126. hash -r
  127. alternative to diff
  128. one can use md5sum
  129. list open TCP sockets
  130. lsof | grep TCP
  131. recursively copy remote folder and keep permissions and modes (alternative to scp)
  132. ssh mperdikeas@172.31.129.29 'tar cpf - cluster/' | tar xpvf -
  133. how to find broken links
  134. find -L -type l
    I.e. find files following links (-L) and report those that remain links (-type l)
  135. find and kill an app
  136. Let's say we need to find and kill the Conkeror app:
    ps axwww | grep conkeror | grep -v grep
          

    or, better yet:

    ps axwww | grep 'c[o]nkeror'
            
    (note: I don't see any difference with the 'axw' flags)

    Once you get the pid a kill -7 should normaly suffice.

  137. troubleshooting sound problems in Ubuntu
  138. 'Tis a long and sad tale. The gist of the matter (and what worked for me) was a combination of purging pulseaudio (including locally modified config files in /etc/pulse) and re-installing it, (and doing the same for other Ubuntu audio libraries as well). Helpful material:
    1. trouble shooting procedure
      I followed the above guide on 2016-04-21 on my 12.04 LTS machine and what did the trick was Step 6 where I am asked to install and use pavucontrol:
      sudo apt-get install pavucontrol
      pavucontrol
                    
    2. trouble shooting guide
    Actually, the second was rather more helpful than the first.

    Litmus tests:

    play /usr/share/sounds/alsa/Front_Center.wav
                
    ... and the Skype echo service.

    Another thing to check out for is to make sure that the user belongs to the audio group. I.e. do a:

    sudo \emacs -nw /etc/group
                  
    Finally, I also tried this guide on setting the default audio card although it didn't have any effect in this particular case (maybe the problem wasn't there).
  139. re-enable the sound icon on Ubuntu precise
  140. The following incantation worked for me:
    sudo apt-get install indicator-sound
    killall unity-panel-service
                  
  141. how to change a file's encoding from ISO8859-7 to UTF8
  142. It may happen that the javac compiler complains for the encoding used in a file. Rather than using the -encoding option to javac (in the build.xml, use <presetdef> to setup defaults for all of your javac invocations and pass -Dfile.encoding=iso-8859-7) one can also convert the file manually.

    To find the offending file:

     $ ant  2>&1 | grep unmapp | awk '{print $2}' | sed 's,:.*,,' | sort | uniq
                    
    convert it with iconv:
    iconv -f ISO8859-7 -t UTF-8 
                    
    (you may also have to export LANG=en_US.UTF-8)
  143. piping with xargs
  144. To rm all java files (you need the -print0 and -0 options to work with filenames containing spaces etc.):
    find . -iname \*.txt -print0 | xargs -0 rm
  145. pipe coloured output through less
  146. Use the 'ls -RG' option and make sure the original application (that generates the colour-coded output) is set to --color=always if such option exists.
  147. find the package a binary belongs to in Debian distros
  148. E.g. find the package for sensors:

    dpkg -S $(which sensors)
                      
  149. monitor chipset and CPU sensors in Ubuntu
  150. Use sensors from package lm-sensors as in:
    watch sensors
                      
  151. change hostname in Ubuntu
  152. simply edit /etc/hostname and /etc/hosts (for 127.0.0.1). To flush the previous hostname from various applications a reboot may be required.
  153. setting HTTP proxy in Ubuntu
  154. export http_proxy="http://foo.bar:8080"
                      
    subsequent wget requests will redirect to foo.bar:8080
  155. package managers
  156. apt is used in Debian, Ubuntu and rpm in Fedora, Redhat, Suse. apt is better.

    Typical apt commands: apt-get install, apt-cache search, apt-get autoremove, apt-get update.

  157. curl
  158. curl is a Linux utility that can be used to simulate HTTP GET and HTTP POST requests. A simple:
    #curl www.in.gr
    ...will execute an HTTP GET against www.in.gr.
  159. SSE time
  160. get time in SSE:
    date +%s
  161. Linux Operating System Information
  162. General OS information (including whether the kernel is 32 or 64 bit):
    uname -a

    or (if you are only interested in 32bit vs. 64bit):
    arch
    x86_64 GNU/Linux indicates that you've a 64bit Linux kernel running. If you use see i386/i486/i586/i686 it is a 32 bit kernel.
    NB:This applies to the operating system kernel, not the CPU itself.
  163. Find if CPU is 32 or 64 bits
  164. grep ^flags /proc/cpuinfo | uniq | grep lm

    ("lm" means long mode CPU - 64 bit CPU)
  165. find installed packages
  166. apt-cache search  - or -
                          dpkg --get-selections | grep 
                        
  167. how to find a file named "compile_decoder.sh" in a set of bz2 files
  168. for f in `ls *.bz2` ; do tar -jtvf  $f ; done | grep compile_decoder.sh

    ... Actually, the following also works and produces identical output:
    for f in `ls *.bz2` ; do tar -jtvf $f | grep compile_decoder.sh ; done
  169. to find out the release
  170. $ lsb_release -a
  171. how to start xserver in Cygwin:
  172. startxwin
    ... and then to redirect X output from the new shell:
    ssh -X mperdikeas@remote.location
  173. see all processes run by user 'mperdikeas':
  174. $ps -u mperdikeas
  175. bootable USB drive from ISO image
  176. In order to create a bootable USB drive from an ISO image it is not possible to use dd and perform a binary data copy. Special magic has to be used. Ttsiodras sent me a folder with the necessary magic. Bottom line is that the files in the ISO image are actually copied and that special bits are set in the flash drive's filesystem to denote the partition as bootable. See folder CreateUSBstickFromISO. However I was not able to make it work; the USB flash drive was formated and created but I wasn't ablt to boot it. In the end I just burned a CD. BTW the following page: http://www.ubuntu.com/download/ubuntu/download created detailed instructions on how to create a USB flash drive and suggests another solution ("Pen Drive Linux's USB Installer"). There is also another option which is to create a Live Linux USB stick or even a persistent one (with the ability to save files, install programs and so on). This option is possible using the "LinuxLive USB Creator 2.8.10.exe" program.
  177. to find the Linux kernel release and distro:
  178.         uname -mrs
            lsb_release -a
              
  179. how to find if a Linux machine is 32 or 64 bits:
  180. uname -m
    - or -
    cat /proc/cpuinfo
  181. Print recursive size of folders (i.e. including contents):
  182.                 sudo du - s -m *
              
    (because ls -lah only displays the size of the directory file).
  183. proper way to copy recursively directory tree a into b (including file permissions etc):
  184. cp -a a b

    You don't need anything else and the internal symbolic links are nicely preserved.
  185. how to find in which package a binary belongs, e.g. the lsb_release binary:
  186. dpkg -S $(which lsb_release)
  187. to show the versions of debian apt packages use the apt_show_versions utility
  188. apt things ...
  189. The /etc/apt/sources.list file is not directly related to the operations of the: apt-get dist-upgrade command the dist-upgrade command always stays in the same Debian version but implements the progression: stable->testing->unstable. So, for instance from the stable phase it takes two invocations of the dist-upgrade to reach the unstable phase; from the testing phase only one. And you can't go backwards. The /etc/apt/sources.list file "simply" provides the URL of the repositories for each version.
  190. hex-dump:
  191. hexdump -C  ('C' for console output)
    to edit:
    hexedit
  192. how to cut the first few lines of a file (in the below example, the 1st one):
  193. tail -n +2 "$FILE"
  194. how to remove the last line from a file (in place editing):
  195. sed -i '$d' filename
  196. how to remove the last n lines from a file (in the below example n = 2):
  197. head -`wc -l thefile | awk '{print ($1-1)}'` thefile