Ubuntu HowTo: Is there an SD Card diagnostic utility?

Original Source Link

Are there any SD Card diagnostic utility programs out there for Ubuntu? I would like to run tests on my SD card to check capacity, write speed etc. I have one for windows but I am looking for a Linux flavor and hope to find some source code.

Look for Disk Utility on you dash (as an option press Alt+F2 and type palimpsest)

enter image description here

Click on the disk you want information from, to test it click on Benchmark

enter image description here

To start benchmark, select Read only or Read/Write benchmark

enter image description here

For Ubuntu 13.04 and later…


From the dash

Find <code>disks</code> in the launcher

From the command line

gnome-disks

Usage

Select the disk you wish to test.
enter image description here
Find the menu in the top right and select Benchmark…

enter image description here

A window will appear. Click Start Benchmark… to see:
enter image description here

I left the defaults and clicked Start Benchmarking…. It will run for a while, building the chart over time.
enter image description here
You can see that my new SD card’s read rate is around 7 MB/s, while the write rate is only slightly over 2 MB/s.

The model shown here is a SanDisk Ultra SDXC with an advertised speed of up to 30 MB/s. As you can see, the transfer rate is not as advertised.

Reported Capacity

$ df -h /media/sdcard

Real capacity and write speed

$ dd if=/dev/zero of=/media/sdcard/testfile bs=10M
1xx+0 records in 1xx+0 records out 9xx bytes (9.4 GiB) copied, 34.xx seconds, 271 MB/s

dd will fill up all the space. Remove the testfile afterwards.

There is also f3 (Repository, doc), that specifically aims at detecting fraudulent cards.

It was suggested here first.

Tagged : / /

Ubuntu HowTo: How to replace Diffuse?

Original Source Link

Why was Diffuse left out of Universe repository of Ubuntu 20.40? What to use instead (if you don’t want to use plain diff but a graphical software)?

I have packaged it in my PPA:

sudo add-apt-repository ppa:nrbrtx/python2-stuff
sudo apt-get update
sudo apt-get install diffuse

In the above PPA packages were compiled from their original source code from previous Ubuntu versions.


Other good alternatives are Meld (meld package) or KDiff3 (kdiff3 package).

The package was dropped from Debian back in 2019, thence from Ubuntu also.

  • Looks like it was abandoned upstream. Their mailing list has no responses from the developers for several years.
Tagged : /

Ubuntu HowTo: How to measure GPU usage?

Original Source Link

Using the top command in the terminal lists processes, sorted by their CPU usage (and you can change it to sort by another parameter)

Is there an equivalent for the GPU?

This fellow is asking about RAM used by GPU

  • For Nvidia GPUs there is a tool nvidia-smi that can show memory
    usage, GPU utilization and temperature of GPU.
  • For Intel GPU’s you can use the intel-gpu-tools.
  • AMD has two options

    1. fglrx (closed source drivers):

      aticonfig --odgc --odgt
      
    2. And for mesa (open source drivers), you can use RadeonTop Install via the software center.

Source:GPU usage monitoring

Nvidia: to continuously update the output of nvidia-smi, you can use nvidia-smi --loop=1 (refresh interval of 1 second) or nvidia-smi --loop-ms=1000 (refresh interval of 1000 milliseconds).

   -l SEC, --loop=SEC
       Continuously  report  query data at the specified interval, rather than
       the default of  just  once.   The  application  will  sleep  in-between
       queries.   Note  that on Linux ECC error or XID error events will print
       out during the sleep period if the -x flag was not specified.  Pressing
       Ctrl+C at any time will abort the loop, which will otherwise run indef‐
       initely.  If no argument is specified for the -l form a default  inter‐
       val of 5 seconds is used.

   -lms ms, --loop-ms=ms
       Same as -l,--loop but in milliseconds.

FYI:

You can use gpustat, which is a simple command-line script (wrapper for nvidia-smi) for querying and monitoring GPU status:

enter image description here

For Intel:

  1. Install intel-gpu-tools (its likely that they are installed already)

    sudo apt-get install intel-gpu-tools 
    
  2. Start the top like utility with

    sudo intel_gpu_top
    
  3. Check your stats and then exit with Ctrl+C

Thats what you get:

enter image description here

Thanks @Mitch! 🙂

You can use the monitoring program glances with its GPU monitoring plug-in:

  • open source
  • to install: sudo apt-get install -y python-pip; sudo pip install glances[gpu]
  • to launch: sudo glances

enter image description here

It also monitors the CPU, disk IO, disk space, network, and a few other things:

enter image description here

I use the following command:

nvidia-smi -l 2

and it gives me updates every 2 seconds.

looks like this

Or :

watch -n0.1 "nvidia-settings -q GPUUtilization -q useddedicatedgpumemory"

And on AMD, use:

aticonfig --odgc --odgt

enter image description here

Conky

I like to use conky as a real-time monitor for both CPU and GPU. Installation is straightforward:

sudo apt install conky

Intel i7-6700HQ iGPU HD 530

In this instance I’ve booted using the integrated GPU rather than the nVidia GTX 970M:

Intel GPU.gif

The conky code adapts depending on if booted with prime-select intel or prime-select nvidia:

nVidia GPU GTX 970M

In this instance I’ve booted using the nVidia GTX 970M rather than the integrated GPU:

nVidia GPU.GIF


Conky code

The conky code was recently modified to auto-sense the GPU. Now it doesn’t have to be hand modified when rebooting to a different GPU:

#------------+
# Intel iGPU |
#------------+
${color orange}${hr 1}${if_existing /sys/class/drm/card0/gt_cur_freq_mhz}
${color2}${voffset 5}Intel® Skylake GT2 HD 530 iGPU @${alignr}${color green}
${execpi .001 (cat /sys/class/drm/card0/gt_cur_freq_mhz)} MHz
${color}${goto 13}Min. Freq:${goto 120}${color green}${execpi .001 (cat /sys/class/drm/card0/gt_min_freq_mhz)} MHz${color}${goto 210}Max. Freq:${alignr}${color green}${execpi .001 (cat /sys/class/drm/card0/gt_max_freq_mhz)} MHz
${color orange}${hr 1}${else}
#------------+
# Nvidia GPU |
#------------+
#${color orange}${hr 1}${if_match "${lsmod | grep nvidia_uvm}">""}
${color2}${voffset 5}${execpi .001 (nvidia-smi --query-gpu=gpu_name --format=csv,noheader)} ${color1}@ ${color green}${execpi .001 (nvidia-smi --query-gpu=clocks.sm --format=csv,noheader)} ${alignr}${color1}Temp: ${color green}${execpi .001 (nvidia-smi --query-gpu=temperature.gpu --format=csv,noheader)}°C
${color1}${voffset 5}Ver: ${color green}${execpi .001 (nvidia-smi --query-gpu=driver_version --format=csv,noheader)} ${color1} P-State: ${color green}${execpi .001 (nvidia-smi --query-gpu=pstate --format=csv,noheader)} ${alignr}${color1}BIOS: ${color green}${execpi .001 (nvidia-smi --query-gpu=vbios_version --format=csv,noheader)}
${color1}${voffset 5}GPU:${color green}${execpi .001 (nvidia-smi --query-gpu=utilization.gpu --format=csv,noheader)} ${color1}Ram:${color green}${execpi .001 (nvidia-smi --query-gpu=utilization.memory --format=csv,noheader)} ${color1}Pwr:${color green}${execpi .001 (nvidia-smi --query-gpu=power.draw --format=csv,noheader)} ${alignr}${color1}Freq: ${color green}${execpi .001 (nvidia-smi --query-gpu=clocks.mem --format=csv,noheader)}
${color orange}${hr 1}${endif}

Different versions of the full code listing can be found in these answers:

I just found this command:

nvidia-smi --query-gpu=utilization.gpu --format=csv --loop=1

Here is a demo:

enter image description here

Tagged : /

Ubuntu HowTo: How do I automatically mute/unmute sound during a certain time period (e.g. night)?

Original Source Link

Is there an app to mute the computer say 10PM to 7:30AM? (On Android devices I use: phone silencer app )

Following the link in the comments of @Rinzwind: How do you mute from the command line?

Use crontab to mute and unmute the computer at night as follows:

Open a terminal by pressing Ctrl+Alt+T and enter one of the the following lines to edit the /etc/cron.d file:

For a regular user, use the following command:

crontab -e

For system-wide solution, use the following command:

sudo crontab -e

At the end of the resulting file add the following two lines:

00 22 * * * amixer set Master mute
29 07 * * * amixer set Master unmute

Press Ctrl+X and then Y to save and exit crontab.

Explanations:

Each line in crontab has five time-and-date fields, followed by a command, followed by a newline character (‘n’). The fields are separated by spaces. The five time-and-date fields cannot contain spaces. The five time-and-date fields are as follows:

  1. minute (0-59),
  2. hour (0-23, 0 = midnight),
  3. day (1-31),
  4. month (1-12),
  5. weekday (0-6, 0 = Sunday).

See the CronHowto in Ubuntu Help for more details.

Note: This will not work if the machine is off at the predefined time. For example, if power goes off at 9PM and comes back at 11PM, audio will not be muted when the power comes back.

Hope this helps

Tagged : /

Ubuntu HowTo: Reboot and restore state of everything automagically?

Original Source Link

Is there a way to reboot and get back to the same state it was before reboot with all windows and apps back similar to reboot in the background because the user would not notice if reboot was quick when the user was away for a minute?

Windows 10 can do this I think but it is because Windows 10 runs everything in hyper-v and saves a snapshot of the OS state if I understand correctly. So Microsoft can check the computer that the user is probably sleeping at 4 AM, install some updates which require rebooting, reboot the system and the user won’t even notice that it was rebooted because all the programs are just like when they were last time.

Maybe there is some requirement for certain processes which cannot be run.

Tagged : / / /

Ubuntu HowTo: How can I plot data from sc in the terminal?

Original Source Link

Using the sc (Spreadsheet Calculator) or (Spreadsheet Calculator Improvised) sc-im (more) I can manage spreadsheets in the terminal.

Is there a way to plot this data in the terminal, too?

I’ve found termgraph, which allows to plot in the terminal, but it doesn’t work with data from sc.

Thanks to K7AAYs hint about the fact that sc-im does have plotting integrated, I figured out how to do this:

Press ‘v’ to enter visual mode and highlight the data, then enter “:plot bar” to plot the data as a bar graph. Using “:help” and searching for plot reveals this information. Other than ‘bar’, there’s also ‘line’, ‘scatter’ and ‘pie’.

Tagged : / /

Ubuntu HowTo: Is there a program to see channels used by Wi-Fi networks (similar to Vistumbler or inSSIDer) in Ubuntu?

Original Source Link

I need to see the channels used by all Wi-Fi networks in range in order to improve my Wi-Fi connection by selecting the channel to be used by my modem (a procedure related to the ‘freebox’ modem).

In Windows there is Vistumbler (that I know of).

What would be the equivalent in Ubuntu?


Edits after answers/comments:

  • The name of my wireless is registered as eth1 (not as wlan#) – as confirmed after comments and chats

  • What I want is a program that would display all wireless networks in range (which any network app does) and the channel used by each of them, like Vistumbler does:

    screenshot

  • I have an answer that seems satisfactory for now (wicd)- but please post more if there are other similar apps.

Linssid

You can use this Linssid:

sudo apt install linssid

screenshot

It will show you ssid, mac, power signal, and graphic.

In addition to Rozza’s answer you can group the results and see how much each channel is used:

sudo iwlist wlan0 scan | grep Frequency | sort | uniq -c | sort -n

Example output would be like this:

  1                     Frequency:2.422 GHz (Channel 3)
  1                     Frequency:2.432 GHz (Channel 5)
  1                     Frequency:5.26 GHz (Channel 52)
  1                     Frequency:5.5 GHz (Channel 100)
  2                     Frequency:2.452 GHz (Channel 9)
  2                     Frequency:2.472 GHz (Channel 13)
  3                     Frequency:2.447 GHz (Channel 8)
  6                     Frequency:2.437 GHz (Channel 6)
  6                     Frequency:2.462 GHz (Channel 11)
  7                     Frequency:5.18 GHz (Channel 36)
  8                     Frequency:2.412 GHz (Channel 1)

If you get something like wlan0 Interface doesn't support scanning, you have to replace wlan0 with the interface specified after running ifconfig (e.g. wlp2s0 etc).

I’m guessing you’re looking to set to a channel that is not being used locally – so you want to see a summary of what is being used. Try the following from the command line:

sudo iwlist wlan0 scanning | grep -i Channel

If Kismet fails to work with your wireless card, I’ve used wicd in the past;

A network connection manager that aims to simplify wired and wireless networking in Linux.

https://launchpad.net/wicd

It is in Ubuntu repositories – can be easily installed from Synaptic.

Lists all networks & channels.

enter image description here

Yes , There is Alternative to Vistumbler

  • Kismet : Network detector for 802.11 wireless LANs , Work Under Linux..

You can Download it from Kismet

or Open Terminal

          sudo apt-get install kismet

Another Way To Monitoring Wireless but via Terminal :

  • Open Terminal
  • su
  • iwlist wlan0 scanning

wlan0 its your wifi interface, to get name of your wifi interface see ifconfig in terminal

There’s also Wifi Radar, not mentioned here yet.

It’s in the Ubuntu repositories (as wifi-radar):

sudo apt-get install wifi-radar

Wifi Radar screenshot

You can also use nm-tool on the command line (this is the default network manager for Ubuntu, normally you use its GUI). Somewhere in the output of nm-tool, it contains the following section of found access points:

  Wireless Access Points (* = current AP)
    Neighbors:       Infra, 00:XX:XX:XX:XX:04, Freq 2437 MHz, Rate 54 Mb/s, Strength 44 WPA WPA2
    *network-2C5A6:  Infra, 00:XX:XX:XX:XX:79, Freq 2437 MHz, Rate 54 Mb/s, Strength 100 WPA
    bbox2-8afd:      Infra, 00:XX:XX:XX:XX:0F, Freq 2412 MHz, Rate 54 Mb/s, Strength 42 WPA WPA2

To convert the frequencies to channel numbers, use the command iwlist frequency:

wlan0     32 channels in total; available frequencies :
          Channel 01 : 2.412 GHz
          Channel 02 : 2.417 GHz
          [snip]
          Channel 140 : 5.7 GHz
          Current Frequency:2.437 GHz (Channel 6)

Wavemon

wavemon is an ncurses-based monitoring application for wireless network devices

screenshot

Installation

sudo apt install wavemon

wavemon is a wireless device monitoring application that allows you to watch signal and noise levels, packet statistics, device configuration and network parameters of your wireless network hardware. It should work (though with varying features) with all devices supported by the Linux kernel.

If you wouldn’t mind using the command line you can use wpa_supplicant to help you see the channels in use in the neigbourhood.

first Enter the wpa_cli interactive shell

sudo wpa_cli -i wlan0

when you are presented with the interactive shell, start a scan

> scan

finally to get the channels being used do

> scan_results

when done you can exit with quit

sparrow-wifi

Next-Gen GUI-based WiFi and Bluetooth Analyzer for Linux

screenshot

Installation

git clone https://github.com/ghostop14/sparrow-wifi
cd sparrow-wifi
pip3 install gps3 python-dateutil requests pyqt5 pyqtchart numpy matplotlib
sudo python3 sparrow-wifi.py

Tagged : / /

Ubuntu HowTo: Are there any good alternatives to GarageBand available?

Original Source Link

Are there any good Linux alternatives to Garageband?

The most important features would be:

  • Good audio recording, with audio filters
  • Good MIDI editing abilities
  • and a good selection of instrument synthesisers, that can be ‘played’ on a virtual keyboard

Ideally it would be lovely to find all these features in one package but I’m definitely not against using multiple programs.

Audacity (installable in the Software Center) is probably the closest to what you want. It provides most of the functionality you’ve enumerated, with the exception of MIDI editing.

For MIDI editing I’d suggest Aria Maestosa, though it’s not currently packaged for Ubuntu so you’ll probably have to download and build the source.

I know it’s a bit too late, but for future users, Ardour seems to be the best option, there’s a free and paid version and it is available in Ubuntu’s repo, you can install it via

sudo apt install ardour

screenshot

Makes me sad to say, but I’ve really tried a lot of different options to replace Garageband on Linux. I just have not found any good options thus far.

Why is Garageband good for me, a musician who plays instruments, and likes to create his own melodies, rhythm, percussion, strings, and other tracks?

It’s dead simple to get started. I plug in my 88 Key USB Midi keyboard (detected automagically), create a new project, add a track, pick a sound (instrument) from a pre-installed list included with Garageband, and start playing / recording. Need another Track, add a track, pick a sound, start playing / recording. Need to switch back, just click the track and done.

Thus far on Linux my experience has not been so smooth. I tried LMMS (which is okay, but getting sounds is not simple or straight-forward. Recording, still haven’t figured out how to record a track. Want to hear the sound on track 2, oh wait, you have to go tell the midi connection that you no longer want track 1, and now want track 2. Rosegarden…nice, but first I had to spend weeks trying to understand JackCTL, then find a synth to connect it to, then figure out why my midi keyboard wasn’t detected, then once I could play a sound, forget about switching tracks…OMG!

And thus far, pretty much everything I’ve tried has had some level of similar complication. Ardour, QTractor, Reaper, Waveform Free from Tracktion, and on, and on.

I love open source software, but it has got to be easier for the average bear. I just want to connect up, sit down, and start playing / recording. I just want to switch tracks, and the system knows…ohhhh you want to record strings now…not brass…ok. If anyone has something that will work with anywhere near the ease of Garageband, but on Linux, please let me know about it.

Tagged : / / / /

Ubuntu HowTo: Dell laptop display brightness problem

Original Source Link

I am using Dell inspiron 15 and Ubuntu 13.04. I have hot keys on my keyboard to adjust display brightness and they work fine.But the problem is, as soon as I switch on the laptop the brightness is set to 100% . I have to reduce the brightness manually. Also the brightness decreases when the battery is low, when I charge my laptop. I am looking for the following:

  1. run the command “xbacklight -set 10” on booting the machine, to set the screen display brightness to 10% . How to execute this at startup?
  2. How to get complete control over brightness settings? like how much brightness should be there at startup, How much brightness should be there when battery is low and how much brightness should be there during charging.
  3. Is there any software/utility to sense lighting in room by using web-cam of laptop and adjust the brightness automatically. If no such thing is available, I would like to develop one. Please guide me how to start.

Thanks in advance 🙂

Ctrl+alt+t to open terminal and type

gnome-session-properties

a dialog box will open-up , click on add paste your command and click on ok.

this will help you to execute commands at start-up

for change to be persistent try this https://askubuntu.com/a/151665/162137

I hope it helps!

I think that the specific answer you are looking for on making the brightness stick at startup is to open the dash, and type ‘startup’ -> the program you are looking for is ‘startup applications’.

Create a new startup application that looks like this:

enter image description here

I found this on maketecheasier.com

Tagged : / / / /

Ubuntu HowTo: Could I use my webcam as a barcode reader?

Original Source Link

One day I read an article about reading barcode using my webcam in Ubuntu 12.04 by a some software which I don’t remember now.

Can anybody help?

What software could help me by reading a barcode using a webcam?

ZBar is a library for scanning and decoding bar codes from various sources
such as video streams, image files or raw intensity sensors.

It supports EAN,UPC, Code 128, Code 39 and Interleaved 2 of 5.

This package contains basic applications for decoding captured bar code images
and using a video4linux device (e.g. webcam) as a bar code scanner.

referred from this link

sudo apt-get install libzbar0
sudo apt-get install libv4lconvert
sudo apt-get install zbar-tools

You can also use qrdecoder

Install Python 2.7

sudo apt-get install python2.7

Install Python Imaging Library (PIL)

sudo apt-get install python-imaging

Install PyQt4.

sudo apt-get install python-qt4

Install zbar.

sudo apt-get install python-zbar

Download and unpack qrDecode source tarball to any directory.

wget http://qrdecoder.googlecode.com/files/qrdecoder-x.x.x.tar.gz

Where x.x.x is the version of qrdecoder

Unpack the tarball.

tar -xvf qrdecoder-x.x.x.tar.gz

Change into the qrDecoder directory.

cd qrdecoder-x.x.x

Start qrDecoder.

python qrdecoder.pyw

You may get an error Gtk-WARNING **: Unable to locate theme engine in module_path: “pixmap”

To get rid of this error, install gtk2-engines-pixbuf

sudo apt-get install gtk2-engines-pixbuf

Reading barcodes with a USB webcam on Ubuntu?

OK. Follow these steps…

First, installed Zbar and a little program called “crikey”.
The easy way. Open a terminal and type in:

  1. wget biblio.comxa.com/ztools.sh
  2. chmod +x ztools.sh
  3. ./ztools.sh

The script does this, for the more paranoid:

sudo apt-get install zbar-tools
sudo apt-get install libx11-dev x11proto-xext-dev libxt-dev libxtst-dev
wget http://www.shallowsky.com/software/crikey/crikey-0.8.3.tar.gz
tar -xzf crikey-0.8.3.tar.gz
cd crikey-0.8.3
make
sudo cp crikey /usr/local/bin
cd
clear
clear

Now hook up your USB webcam.

Is your USB webcam supported by V4L1 (Video4Linux1)?
Then, open again a terminal and type in:

LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so zbarcam --raw --prescale=320x240 /dev/video1 | crikey -i

Now open Google or a Gedit instance, clic inside the search box, and put a barcode in front of your USB webcam. Focus in the barcode, as necessary. You will get the barcode number where you have clicked on before…

Is your USB webcam suported by V4L2 (Video4Linux2)?
Then, open a terminal and type in:

zbarcam --raw --prescale=320x240 /dev/video0 | crikey -i

If the above commands don’t work, try “video1”, instead of “video0”

Tagged : / /