Linux

$ Random Linux tips and tricks.

How to Make a Bootable USB From Linux ISO File

posted Jan 16, 2018, 3:54 AM by Ali Janah   [ updated Jan 16, 2018, 6:50 AM ]

Question! How do I make a bootable usb pendrive out of a linux distro ISO image?

Answer!  Open up a console then type in the following command:
sudo dd bs=4M if=/path/to/ISO/File.iso of=/dev/sdX status=progress oflag=sync
Then push the enter key.

Note! Repalce the "X" in "sdX" by your pendrive corresponding letter.

A Short and Simple Python Script

posted Dec 2, 2017, 5:58 PM by Ali Janah

# file: App.py
name = input("Hello, what's your name?: ")
print("Hello, " + name + ", and welcome!")
#Taking an integer value and assigning it to the service variable for later use
service = int(input("Now please take a sit and tell me how many guests are you bringing with you tonight?: "))
#Making a condition to define if the subjects will be plural or singular
if service > 1:
    invitee = " guests"
    table = " them."
    clients = " all"
else:
    invitee = " guest"
    table = " the both of you."
    clients = " the both"
print("Oh, " + str(service) + invitee + "..., then I shall prepare a table for" + table)
menu = ["Salad", "Sandwich", "Tiramisu"]
print("In regards to your order, we have " + str(len(menu)) + " specialities today !")
choice = input("What will you begin with, " + menu[0] + ", " + menu[1] + " or " + menu[2] + " ?")
#Add code to accept only the available menu choices
print("So " + choice + " for" + clients + " of you")

Bleeding Edge Graphics Drivers for Kubuntu

posted Jan 13, 2017, 9:31 PM by Ali Janah   [ updated Nov 28, 2017, 1:58 PM ]

Question! How do I install the latest graphics drivers for my GPU (ATI AMDGPU) and the latest mesa under Kubuntu 16.10 (also available for 16.04)?

Answer!  Open up a console then type in the following command:
sudo apt-add-repository 'ppa:paulo-miguel-dias/mesa'
Then push the enter key, and run the next command:

sudo apt update
&& sudo apt upgrade

Note!
after this do a reboot and you should be running the latest mesa and AMDGPU drivers with OpenGL 4, to make sure you can check with the following command:

glxinfo | grep "OpenGL"

Note! If the terminal complains about glxinfo not being available, you should install mesa-utils, just do a:

sudo apt install mesa-utils

Default monitor on dual monitor setup

posted Jun 23, 2016, 12:27 AM by Ali Janah   [ updated Nov 28, 2017, 1:58 PM ]

Question! How to set the default monitor for applications in a dual monitor configuration.

Answer!  Open up a console then type in the following command:

xrandr -q

Identify your primary monitor among the list you get, then type in the following command :

xrandr --output DVI-0 --primary

Note!
Replace DVI-0 by your identified monitor's id.

Convert ZNC logs from version 1.4 to 1.6

posted Jun 2, 2016, 6:30 PM by Ali Janah   [ updated Nov 28, 2017, 1:58 PM ]

Question! How to convert ZNC 1.4 logs to version 1.6.

Answer!
  Download the attached script bellow (convert-znc-1.4-logs-to-1.6.sh), then run it.

sh convert-znc-1.4-logs-to-1.6.sh

Please read the info in the beginning of the script file by editing it :

nano convert-znc-1.4-logs-to-1.6.sh

Note!
Script taken from https://github.com/ZacharyDuBois/Random-Scripts all credit goes to Zachary DuBois.

Run a JNLP file (Java)

posted May 14, 2016, 5:06 PM by Ali Janah   [ updated Nov 28, 2017, 1:58 PM ]

Question! How to run a jnlp file under terminal.

Answer!
  Open up a console or terminal then type the following command :

sudo apt-get install icedtea-netx

Then type the following command always in the console while in the target file's directory :

javaws filename.jlnp

Note! Replace "filename" by the name of the file you want to run.

What is using a specific port (Network)

posted May 4, 2016, 3:10 PM by Ali Janah   [ updated Nov 28, 2017, 1:59 PM ]

Question! How to show what is using a specific port (Network).

Answer!
  Open up a console or terminal then type the following command :

sudo netstat -tunap|grep 23

Note! Replace "23" by the port you want.

Run a java file

posted Aug 7, 2015, 4:52 PM by Ali Janah   [ updated Nov 28, 2017, 1:59 PM ]

Question! How to run a java file under terminal.

Answer!
  Open up a console or terminal then type the following command :

java -jar filenamehere.jar

Batch Image Resize

posted Feb 28, 2015, 5:02 PM by Ali Janah   [ updated Nov 28, 2017, 1:59 PM ]

Question! How to resize multiple images at once.

Answer!
  You will first need a tool called ImageMagick, so bring up the console and type in the following command to install it :

apt-get install imagemagick

 Then type the following command in the console :

for i in $( ls *.jpg); do convert -resize 50% $i re_$i; done

Note! Replace "jpg" by the extension your images have (it's case sensitive), and "50" by the percentile you want your images to be resized by.

Mounting ISO files

posted Jan 11, 2015, 1:04 PM by Ali Janah   [ updated Nov 28, 2017, 1:59 PM ]

Question! How to mount an ISO image file so that you can read its content.

Answer!
Type the following command in the console :

mount -o loop <ISO file> <target directory>

Note! Replace <ISO file> and <target directory> by the corresponding names.

1-10 of 15