Tag Info

New answers tagged

1

The easiest way to accomplish this, would be to do the exact opposite of what you're trying to do: first capture still pictures then convert those still pictures to a video (so basically a combination of both above answers) I would: take a minimum of 16 fps as that is the minimum our brain needs to see smooth motion If this is for a web application, ...


0

The new utility fatrace can show you exactly! See: https://launchpad.net/fatrace/ or run 'sudo apt-get install fatrace'. Then run it: # sudo fatrace chrome(6514): W /home/xxxx/.config/google-chrome/Default/Current Session chrome(6516): R /home/xxxx/.pki/nssdb/cert9.db chrome(6514): RW /home/xxxx/.cache/google-chrome/Default/Cache/data_0 chrome(6516): R ...


0

This is my process. Adapt the numbers as needed execute lsblk first. NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 232.9G 0 disk ├─sda1 8:1 0 1.5G 0 part ├─sda2 8:2 0 138.6G 0 part ├─sda3 8:3 0 8.1G 0 part ├─sda4 8:4 0 1K 0 part ├─sda5 8:5 0 68.5G 0 part / └─sda6 ...


-1

Ok, this is the way I use to go to other partition where I have saved all my data... cd ..` After this `I am on the home folder, so I execute once again cd .. to go to the / directory, once I'm here I execute cd media Here you have all your mounted partitions, just execute: ls and choose which partition you want to get in, and: cd ...


3

That sounds like a syntax error in one of your shell's initialization files. The likeliest culprits are either ~/.bashrc or ~/.profile. The simplest solution is to make a backup of these two files and then overwrite them with the defaults. Make a new user. You will run the necessary commands as this user who, presumably, will have a working shell. Make ...


2

The following perl oneliner will extract the data for you: perl -e '/(.*)\t.*\t(.*)/ and $a{"$1 $2"}++ for (<>); print "$_ $a{$_}\n" foreach (keys%a);' file.tsv Output: joe ibm 2 joe google 2 rachel google 1


1

It seems that the problem is that the environment variable XAUTHORITY is not preserved in the screen session. I solved this by adding the following to my .bashrc. I didn't think this should be necessary but I guess you do what you must: # ensure X forwarding is setup correctly, even for screen XAUTH=~/.Xauthority if [[ ! -e "${XAUTH}" ]]; then # create ...


3

Here is a Pythonic solution using the Counter class of collections module which will count the number of occurrences of each element in an iterable: #!/usr/bin/env python2 import collections with open('file.txt') as f: names = [] for line in f: names.append(line.strip().split()[0] + ' ' + line.strip().split()[2]) result_dict = ...


1

A GNU awk solution using two-dimensional arrays: gawk -F $'\t' '{a[$1][$3]++} END {for (i in a) for (j in a[i]) print i, j, a[i][j]}' foo.txt a[$1][$3]++ for each combination of first name and surname, increment the count Then loop through the first names and the company names associated with each first name. Another way that will work other awks using ...


2

You can make use of cut to select the columns you want to operate on first. So given that your columns are separated by a space, and are FNAME SNAME COMPANY where we are only interested in column 1 and 3 we can use: cut -d' ' -f1,3 file.tsv | sort | uniq -ci This tells cut to separate using a single space ' ' as a delimeter and to pass columns 1 and 3 ...


3

Try help cd: Options: -L force symbolic links to be followed: resolve symbolic links in DIR after processing instances of `..' -P use the physical directory structure without following symbolic links: resolve symbolic links in DIR before processing instances of `..' -e if the -P option is supplied, and the current working ...


2

There is a malformed line in /etc/apt/sources.list.d/mono-xamarin.list at line 3. The best solution is to open that file with an editor an look for that line 3. Then you can comment the line out. Just add a #-character as first character of that line. Then run software-center again.


0

You can also crop PDF files simply using Ghostscript. I have written a small script to simplify the process (inspired by this answer): #!/bin/bash if [ $# -lt 5 ] then echo "Usage: `basename $0` <pdf-file> <x_min> <x_max> <y_min> <y_max>" echo "Notes:" echo " - all coordinates are absolute; no calculation of width/height ...


3

If this works: ls | grep -i 'book_i_want' Then, so will this gnome-open *book_i_want* To make it case insensitive: shopt -s nocaseglob gnome-open *book_i_want* In fact, both of the above will work better than using ls since they can deal with any file name, including those with whitespace and strange characters, which ls can't.


5

To answer the initial question, you would pipe through xargs if you wanted to launch something with STDIN as an argument. ls | ... | xargs gnome-open Or you could treat the output like an argument directly. This is less useful in very long directories as you might hit the argument limit. xargs is almost certainly faster. gnome-open $(ls | ...) But you ...


3

There's a lot of choice using the command line: $ echo "2015-03-02 21:34:15 20480 dump-2015-03-02-21-34.tar" | cut -c32- dump-2015-03-02-21-34.tar $ echo "2015-03-02 21:34:15 20480 dump-2015-03-02-21-34.tar" | sed 's/.* //' dump-2015-03-02-21-34.tar $ echo "2015-03-02 21:34:15 20480 dump-2015-03-02-21-34.tar" | grep -oP "\S+$" ...


2

sed is by default greedy, so just remove everything until the last space: sed 's/.* //' or use this awk idiom: awk '$0=$NF'


3

Try grep: echo "2015-03-02 21:34:15 20480 dump-2015-03-02-21-34.tar" | grep -Eo "[^ ]+$" You can also use tr and cut together: echo "2015-03-02 21:34:15 20480 dump-2015-03-02-21-34.tar" | tr -s ' ' | cut -d' ' -f4 Why should python be left behind: python2 -c 'print "2015-03-02 21:34:15 20480 dump-2015-03-02-21-34.tar".split()[3]' All ...


0

I needed to automate this in a python script, so I adapted LiLo's extremely helpful answer to the following: #!/usr/bin/env python import os import sys from subprocess import Popen, PIPE import fcntl driver = sys.argv[-1] print "resetting driver:", driver USBDEVFS_RESET= 21780 try: lsusb_out = Popen("lsusb | grep -i %s"%driver, shell=True, bufsize=64, ...


2

The simple approach is to find all directories, get their size and delete them if they are under a given threshold: find . -maxdepth 1 -type d | while read dir; do [ $(du -s "$dir") -le 102400 ] && rm -f "$dir"; done However, that will fail on directory names containing newlines or other strange characters. A safer syntax is: find . -maxdepth ...


4

This should work: loadval=$(sar -u 1 10 | awk '{print 100-$8}')


2

You can add it to your ~/.bashrc. That file is read each time a new interactive shell is launched so it will be displayed each time you launch a terminal, or log in to the console or simply run bash. For example, you could add these lines: echo "Hi, how are 'ya?"


1

Here's how I do it: Install gThumb sudo apt-get install gthumb Open up nautilus and go to your images directory. Right click on one and choose Open with -> gthumb. Under the view menu choose Browser or press the Esc key. This will open the directory browser showing all your images. Press Ctrl and select the images you want to rotate or select all ...


2

It is well described in the Gnome wiki, quoting: You can do this with the GSettings key, org.gnome.shell.enabled-extensions, or several tools that manipulate this GSettings key, such as GNOME Tweak Tool or a recent version of gnome-shell-extension-tool. If you invoke gnome-shell-extension-tool --help, you will see that it is capable of enabling and ...


1

This is what told to be the fact: Ubuntu Touch (Ubuntu Phone) uses the Qt 5-based touch user interface and various software frameworks originally developed for Maemo and MeeGo such as oFono as telephony stack, accounts-sso for single sign-on, and Maliit for input. Utilizing libhybris the system can often be used with Linux kernels used in Android, which ...


1

You may have seen the $'...' syntax, which causes the shell to interpret backslash sequences: NC=$'\e[0m' # no color or formatting RED=$'\e[1;31m' # color red GRN=$'\e[1;32m' # color green BLU=$'\e[1;34m' # color blue Another way to do this, using tput: NC=$(tput sgr0) # no color or formatting RED=$(tput bold; tput setaf 1) ...


0

My bad...I was trying to copy a whole directory, not a file. I found out this is accomplished by using cp -a directoryname/. newpath/newexistingdirectoryname/ (and that using "/." is the same as using DOS's "." (wildcard). Sorry about that. And thanks for your help. I'm new to StackExchange. Do I just remove this whole post, or mark it as answered or ...


1

copy-package is good for this, but the correct modern invocation would be: ./copy-package --from=~myname/ubuntu/myppa --from-suite=trusty --to=~myname/ubuntu/myppa --to-suite=utopic -b -y packagename (As saiarcot895 correctly noted, you needed to separate --ppa and --ppa-name, but this was always very confusing which was among the reasons we added the ...


0

when you type the password there, it seems to be freeze. but actual thing which happening is you type password and terminal doesn't show it up. so enter the full password even it doesn't shows and hit enter.


3

This really has nothing to do with whether the data is stored within awk using an array or not. As mentioned by @muru, you can re-format your data into columns using the column command awk 'NR > 1 {print $13,$14,$15}' | column -t Alternatively, just set awk's own output field separator to TAB instead of space directly awk 'NR > 1 {OFS="\t"; print ...


0

use man pages in ubuntu in the terminal type man <command name> eg: man wget it will shows up a detailed description of the command including options.


9

You can define a function in your ~/.bashrc as follows showred(){ export RED='\033[1;49;91m' export NC='\033[0;0;0m' echo -e $RED"$@"$NC } Source ~/.bashrc as . ~/.bashrc or open a new terminal and try. Also you can write in colours while writing something on terminal using echo or printf as following,


3

declare -r RED='\033[0;31m' declare -r GREEN='\033[0;32m' declare -r NC='\033[0m'


0

People are really helpful on this website. I found a "grass roots" answer for "blunderers" and avid "new-to-Linux" dabblers, like myself. Here is a helpful URL if you need 'absolute beginner' help on command line protocol for this type of file. How do I install a .tar.gz (or .tar.bz2) file?. I sorted it out without being a further nuisance and maybe URL ...


0

~ is an abbreviation for the current user's (here: root's) home directory. For normal users, this is /home/MYUSERNAME/ and for root it's just /root/. I would suggest you to try your cp command with the absolute path to the file (/root/MYFILETOCOPY) instead of the account-depending abbreviation (not: ~/MYFILETOCOPY). Does that work?


0

To be usable in as a path you have to URL-encode the string that you get from Nemo. To do so the following oneliner should return the command to use to cd into your mtp device: echo -n mtp://[usb:001,007] | python -c "import sys,urllib; \ print 'cd /run/user/1000/gvfs/mtp:host='+urllib.quote(sys.stdin.readline().replace('mtp://',''))" it returns: cd ...


4

Using Imagemagick to create text icons Based on the same principle as here, the script below creates a text icon from a text file with the help of Imagemagick. The color of the rounded background image and the text color can be set in the head of a script (as well as a number of other properties). What it does It reads the textfile, takes th first four ...


0

Idea : convert the text file to pdf and use pdfdraw to generate the thumbnail. unoconv is a software that converts between various documents that the OpenOffice office suite understands. Advantage of this method : Bulk thumbnails for almost all document can be generated easily by creating a script. See gist for the steps . Install ...


1

To find the shell you have on the default environment you can check the value of the SHELL environment variable: echo $SHELL To find the current shell instance, look for the process (shell) having the PID of the current shell instance. To find the PID of the current instance of shell: echo "$$" Now to find the process having the PID: ps -p ...


3

You can type the following command in your terminal to see which shell you are using: echo $0 Return will look something similar if you are using bash (Bourne Again Shell) -bash


0

To know which is the default shell for your user, you can type: echo $SHELL Possible output: /bin/bash If you didn't change any configuration it should be Bash, because that's the default shell on Ubuntu


0

Your alias wasn't working because it wasn't sourced and this is a frequent problem, having been asked before. As you have noted it was only the text of your question that had the extra typo and not the alias you had placed in your .bashrc, but your modification needed to be re-read for the interactive terminal. Placing an alias in .bashrc with the ...


0

You can write a command script with editor vi or vim. Files shall be executable. Make them with "chmod a+x File" Put your scripy in directory where system path is located. In Terminal you find path with : echo $PATH.


-3

I found the answer. I just added the file into the .bash_aliases file instead. NOTE: I didn't ever have a space before the equal sign. That was just a typo.


2

The reason why your code is not working is because you have got an extra space in the wrong place, try changing your code to this, saving, and then launching a new Terminal session and trying again: alias runmc="java -jar /root/.minecraft/launcher.jar" Although it is recommended that instead of declaring aliases in the .bashrc file that you instead create ...


-1

You need to remove the space from the alias and the equals sign that precedes it. If you type your alias string into bash exactly as shown, you'll notice that it gives you an error: bash: alias: runmc: not found bash: alias: =java -jar /root/.minecraft/launcher.jar: not found If you remove the space (in either your .bashrc or while typing into the bash ...


3

You can use on_ac_power to run a script when the power supply is turned on or off. Try the following in a terminal. $ on_ac_power $ echo $? 0 ## Laptop on ac power $ on_ac_power $ echo $? 1 ## Laptop on battery (not on ac power) Based on this you can make your script as, #!/bin/bash while true do if on_ac_power; then ...


0

Aliases can take parameters. For example: $ alias 777='sudo chmod -R 777 ' $ 777 MyFolder will perform chmod recursively on MyFolder


0

Comment GRUB_TERMINAL=console to #GRUB_TERMINAL=console. Edit GRUB_GFXMODE=1360x768 to the resolution of your monitor (it may already be the correct resolution). Update grub and reboot. If this didn't fix your problem, comment that GRUB_GFXMODE line out. You might have to sacrifice the grub menu resolution to use your tty's; I have had that problem before.


1

To revert the change run sudo sed -i -e 's/GRUB_TERMINAL/#GRUB_TERMINAL/g' /etc/default/grub Or when you edit /etc/default/grub, just add a # to the GRUB_TERMINAL line. Then run sudo update-grub The reboot FWIW sed is a powerful command and substitues one sting for another, so all the sed command is doing is commenting out , or removing the comment ...



Top 50 recent answers are included