Tag Info

New answers tagged

1

Here's a variation on Oli's excellent solution: awk '{if(l1>0){print $2-l1,$10-l2} else{l1=$2; l2=$10;}}' \ <(grep wlan0 /proc/net/dev) <(sleep 1; grep wlan0 /proc/net/dev) It will print the same result as Oli's approach: $ awk '{if(l1>0){print $2-l1,$10-l2} else{l1=$2; l2=$10;}}' \ > <(grep wlan0 /proc/net/dev) <(sleep 1; grep ...


1

Oddly the easiest way seems to be looking at /proc/net/dev. I've written the following to compare that file twice (with a second delay) and then to subtract the total bytes values. In this case em1 is the network adaptor so just change that to whatever you need to look at. awk '/em1/ {print $2 " " $10}' <(cat /proc/net/dev) <(sleep 1; cat ...


4

My variant on what's already offered: . /etc/os-release; echo ${VERSION/*, /} The shortest, Bashiest answer to date. If you don't care to load /etc/os-release's contents into your current environment, you can fake bash into thinking it's loading a script fairly easily: bash <(cat /etc/os-release; echo 'echo ${VERSION/*, /}')


1

. /etc/os-release echo $VERSION


6

Using no external tools: You can just source (the source command is a dot .) the /etc/os-release and you'll have access to all the variables defined there: $ . /etc/os-release $ echo "$VERSION" 14.04, Trusty Tahr Edit. If you want to remove the 14.04, part (as asked by terdon), you could: $ . /etc/os-release $ read _ UBUNTU_VERSION_NAME <<< ...


1

Here are some more choices. They all parse the /etc/os-release file which, on my 13.10, looks like this: NAME="Ubuntu" VERSION="13.10, Saucy Salamander" ID=ubuntu ID_LIKE=debian PRETTY_NAME="Ubuntu 13.10" VERSION_ID="13.10" HOME_URL="http://www.ubuntu.com/" SUPPORT_URL="http://help.ubuntu.com/" BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/" All of the ...


3

The command you are looking for is: grep -oP '(?<=VERSION\=\"(\d\d)\.(\d\d)\,\ )(.*?)(?="$)' /etc/os-release This is very ugly and not optimized. I'm sure there should be an easier method and this has some issues.


4

Grep: $ grep $(lsb_release -rs) /usr/share/python-apt/templates/Ubuntu.info | grep -m 1 "Description: Ubuntu " | cut -d "'" -f2 Trusty Tahr Explanation: lsb_release -rs -> Prints your installed Ubuntu version. grep $(lsb_release -rs) /usr/share/python-apt/templates/Ubuntu.info -> Grab all the lines which contains your release version, in my case it's ...


0

I tried following the steps given by drc, but got strange errors (perhaps due to lack of clipboard support). The following worked for me in ubuntu 13.10 docker image, with just a standard version of Vim without clipboard support: vim /etc # blank screen wget http://www.vim.org/scripts/download_script.php?src_id=21427 -O netrw.vba.gz # install the ...


6

By default less is installed as an replacement for more. It supports PgUp and PgDown but doesn't have the blue bar. The one with the blue bar is most.


5

You can combine your command with a command that plays sounds. For example paplay: sudo apt-get update && sudo apt-get upgrade; paplay /usr/share/sounds/ubuntu/stereo/message.ogg Furthermore, if you want to play a sound if the command was successfully completed and another sound in case of an error, you can use something like: command && paplay ...


0

Try the below command on terminal, sudo apt-get update && sudo apt-get upgrade && aplay /path/to/Sound/filename.wav /path/to/Sound/filename.wav - path to your .wav file. The sound wiil be played only if both the commands are executed successfully.


2

Tmux is a rewrite of GNU Screen, tmux offers a variety of improvements. Some of the most important include a client-server model, which allows you to connect to a tmux session from multiple locations, and a cleaner configuration file format. Check out tmux’s FAQ to discover a list of ways it differs from GNU Screen. Use this command to install tmux on ...


4

Your question isn't very clear but if by "archive" you mean a compressed file (such as zip) then perhaps this answer will help? How to mount a zip file as a file system? After mounting the archive you would be able to cd into it.


1

From the error you got from the FreeBASIC compiler you need to install the following packages: sudo apt-get install libx11-dev libxext-dev libxpm-dev libxrandr-dev libxrender-dev When you have to install -dev packages, http://packages.ubuntu.com/ is a good place for finding the library package name. Finally use /usr/local/bin/fbc -lang qb roids.bas to ...


0

Geany uses GTK+ 2.0 so you need libvte9 sudo apt-get install libvte9


2

Just drag the folder or file you want to access, to the terminal, and you will have the location to access it in the terminal.


2

Simply put this function is your .bashrc: catls() { [[ -f "$1" ]] && cat "$1" || ls "$1"; } It will cat regular files but call ls for directories


2

Normally you edit /etc/sysctl.conf and make those adjustments (rather then directly editing) See: http://www.cyberciti.biz/faq/linux-kernel-etcsysctl-conf-security-hardening/ /proc is a "virtual file system" used by the kernel and the information within the "files" is managed by the kernel and adjusted / configured by editing system configuration files ...


0

drives do not exist in the file system by their label... you can access it in CLI like so mount /dev/sdb /any/directory/you/want cd /any/directory/you/want that is assuming that the drive is in fact refered to as sdb and a directory called /any/directory/you/want already exists some basic info on mounting ...


-1

of=/dev/rdiskN bs=1m I didnt realize my first time that the N is still a variable for the disk number you found when running diskutil list


0

You can also use printf shell builtin to do arithmetic calculations on terminal. printf `expr $num1 + $num2` # num1,num2 are variables which stores numbers as values. Example: $ printf "$(expr 10000 + 9000)\n" 19000 $ printf "$(expr 10000 - 9000)\n" 1000


0

As posted above, enscript is a popular way to convert text to postscript, which can then be further converted to PDF. A similar tool, which has been around for a long time, is a2ps. It has a large number of options, including putting multiple pages on a physical page. Install ap2s with sudo apt-get install a2ps. AFAIK, enscript and a2ps do the same job, ...


0

"cat -v file " will show the non-printing characters in the file. Just redirect the output to some temporary file and use vim for replacing the M-BM- characters with nothing. %s/M-BM- //g Easiest solution.


0

Background process is just process that run independently on background and does not affect to the any of the foreground process. You can refer: http://cs.brown.edu/courses/bridge/1998/res/UnixGuide.html for more details.


1

From the bash manual: Pathname Expansion: After word splitting, unless the -f option has been set, bash scans each word for the characters *, ?, and [. If one of these characters appears, then the word is regarded as a pattern, and replaced with an alphabetically sorted list of file names matching the pattern. If no matching file ...


3

You can try using rsync: rsync -av --include="*/" --include='*.png' --exclude='*' parent1 parent2 this creates directory parent2 and copies all files with .png extension with subdirectory structure to it. explanation -v verbose to see whats copied -a archive mode (copy subdirectories with same ownership, permissions etc.) --include '*/' ...


2

Copy parent1 to parent2 Remove dat files from parent2 subdirectories Remove png files from parent1 subdirectories $ cp -r parent1/ parent2 $ rm parent2/*/*.dat $ rm parent1/*/*.png


5

The shell keeps a history of the commands that you type, that's what the history command gives you. There is no automatic history of the output from the commands that you run in the terminal. Once you close the terminal, the output is lost unless you saved it somewhere. You can save a complete transcript of a terminal session by running the script command. ...


3

The command to enable the firewall is $ sudo ufw enable Firewall is active and enabled on system startup $ _ You can disable the firewall with $ sudo ufw disable You can check the current status of the firewall with $ sudo ufw status Status: active $ _


0

Please see man history for more details: DESCRIPTION Many programs read input from the user a line at a time. The GNU History library is able to keep track of those lines, associate arbitrary data with each line, and utilize information from previous lines in composing new ones. HISTORY EXPANSION The history library supports a history expansion ...


4

The simple definition is a process that isn't connected to an active terminal or display... But there are multiple ways of achieving this: Most of what we consider backgrounded processes are system services. These will often be a started by a high-level init daemon (Upstart, Systemd, etc) and usually remain a child of that daemon. It will have its output ...


1

A background process is a computer process that runs "behind the scenes" (i.e. in the background) and without user intervention. Typical tasks for these processes include logging, system monitoring, scheduling, and user notification. From a the command line, a background process can be launched using the & operator. The bg utility can resume a suspended ...


4

Background means that a process is running on your system that is not visible on the desktop (ie. it does not have to have an application on the desktop open). The command to view ALL processes is called 'ps'. Example with ps -ef: ps -ef UID PID PPID C STIME TTY TIME CMD root 1 0 0 apr10 ? 00:00:02 /sbin/init root ...


1

Only links can be opened from a terminal (right-click -> Open Link), basically you'd need to prefix your file path with the full URI: /home/dell/pcl/2d/include/pcl/2d/impl/keypoint.hpp becoming (just add the file:// prefix): file:///home/dell/pcl/2d/include/pcl/2d/impl/keypoint.hpp Note: This command will give you the absolute path URI to a file: ...


1

Does this help: Using ssh to browse remote file system in Dolphin & Konqueror on KDE and then redirect the stderr to a file or /dev/null like so: dolphin sftp://<usr@host>/ 2> /dev/null


12

You are using two different things here and should be using a third. Let's see: | : This is the pipe operator, it serves to pass the output of one process as input to another: foo | bar This runs the program foo and passes its output as input to the program bar. >,<,>> and <<: These are the redirection operators, they serve to send ...


11

In this case, echo "notify-send HELLO" is a process not a file - so you need a process substitution rather than a file redirection at now < <(echo "notify-send HELLO") You could also have used a here string to avoid the echo command entirely at now <<< "notify-send HELLO"


0

The problem is that your URL contains special characters that are being interpreted by the shell because you are not quoting it. So, short answer, use quotes: lynx -accept_all_cookies 'https://github.com/search?q=jquery+stars%3A>10+forks%3A<10&type=Repositories' Long answer: The specific issues here are >10 and &. The & sends a job to ...


3

Bash is interpreting the URL. The < and & mean things to it so they're being ripped around and aren't being passed to lynx. The simple answer is to quote the url: lynx -accept_all_cookies 'https://github.com/search?q=jquery+stars%3A>10+forks%3A<10&type=Repositories' I'm using single quotes here so that even $ isn't interpreted.


6

The schema is org.compiz.core and it is a relocatable scheme (this makes it possible to support multiple profiles for Compiz). For relocatable schemes you have to add the path if you use gsettings. It's /org/compiz/profiles/unity/plugins/core/ for the Compiz profile unity: gsettings set org.compiz.core:/org/compiz/profiles/unity/plugins/core/ hsize 4 ...


9

You can use dconf: To get the current values: dconf read /org/compiz/profiles/unity/plugins/core/hsize dconf read /org/compiz/profiles/unity/plugins/core/vsize To set new values: dconf write /org/compiz/profiles/unity/plugins/core/hsize 2


1

wget supports regexes with the --accept-regex parameter. So wget -A "1024x768.jpg" would download any file ending with "1024x768.jpg". If you want different sorts of resolutions the digits can be changed to match d+. Something like: wget -A "d+xd+.jpg$" (pseudo example). The regex depends on the shell you use.


3

python -c "your code here" input.txt Or, if your program has multiple lines and eval() is too slow: python yourprogram.py input.txt This oneliner works: python -c "for l in open('input.txt'):print(','.join(sorted(l.strip().split(','), key=int)))"


3

Here comes an awk solution, while read -r line; do (echo $line | awk '{ n=split($1,a,","); asort(a); for(i=0;i<=n;i++) { print a[i];}}') | xargs | sed -e 's/ /,/g'; done < text.txt Explanation: awk '{ n=split($1,a,","); asort(a); for(i=0;i<=n;i++) { print a[i];}}' awk Splits the field 1 according to the delimiter , and store each value into ...


0

For those that don't need to have a command line option, K3b and Brasero are supposed to be able to do it, however I could not make the latter work on my 12.04 64 bit machine, but it's working fine with K3b. For this to work you need to: have a .cue file for your image, make one manually if you don't enable the K3b FLAC Decoder plugin install the FLAC++ ...


0

File command is great , but for more professional analyzing tool , i would like you to try TrID package which is a File Identifier tool. TrID is an utility designed to identify file types from their binary signatures , and its easy to use . For more information and the package just visit : Site


3

Using tr and sed Similar in spirit to what jkt123 wrote: while read i; do tr , \\n <<< $i | sort -n | tr \\n , | sed 's/,$//'; done It iterates over the lines, and for each line replaces commas by newlines, sorts the resulting lines numerically, then turns newlines back to commas. The main problem is that this will end the whole result with a ...



Top 50 recent answers are included