Tag Info

New answers tagged

1

This is not actually a particularly good job for sed but here goes: sed -nr 's#.*/([^"]+).jpg.*#\1#p' file The above will get you a list of numbers, one per line: 20 20 32 32 32 30 30 30 Now, it is actually possible to get all these on the same line with 7 numbers per line using sed but it is really not worth the effort. Just use standard *nix tools ...


3

I assume you're trying to scrape some sort of result. In this example there are only three balls and we can extract them by searching for Balls/<one-or-many-digits> and grouping (the \(..\) construct) around the number and then replacing the whole lot with that group (the \1 is a reference to the first group). $ sed -n 's/.*Balls\/\([0-9]\+\).*/\1/gp' ...


1

Could not resist adding the verbose option (python script) #!/usr/bin/env python3 with open("file1") as l: l = [item.replace("\n", "") for item in l] with open("file2") as l2: l2 = [item.replace("\n", "") for item in l2] for item in [l[i]+" "+l2[i] for i in range(0, len(l))]: print(item) >>> 1 10 10 2 20 11 3 30 12 4 40 13 5 50 14 ...


2

paste is pretty handy here but it'll punish you if the number of values is unequal: $ paste -d' ' myFile{1,2} 1 10 10 2 20 11 3 30 12 4 40 13 5 50 14 6 60 15 16 If you wanted to arbitrarily limit the lines used in the second file to the first, you can, it's just going to be a bit slower and use more RAM (not that it matters on such a small data set). $ ...


0

==> ulimit -a core file size (blocks, -c) 0 data seg size (kbytes, -d) unlimited scheduling priority (-e) 0 file size (blocks, -f) unlimited pending signals (-i) 4549 max locked memory (kbytes, -l) 64 max memory size (kbytes, -m) unlimited open files (-n) ...


1

How many url? For a single url curl 123$((RANDOM%1000+100))blabla.html for more then one, you need a loop as steeldriver indicated


0

The command is: curl `printf "%.3d" $(( $RANDOM % 1000 ))``printf "%.3d" $(( $RANDOM % 1000 ))`blabla.html Explanation: $(( $RANDOM % 1000 )) creates an (almost) random number in the range 0-999 printf "%.3d" 12 formats the number (in this case 12 but in the command above the output of the random division) with a leading zero(es) the backtick around the ...


1

In this case, you should be able to capture the output of the command using $(command ...) and then loop over the values, e.g. for i in $(shuf -i 100-999 -n10); do curl "123${i}blabla.html"; done


0

Open a Terminal and go to the directory where you downloaded HoNClient-3.4.3.sh and type: chmod 777 ./HoNClient-3.4.3.sh Then all you need to do is to start the program like this: ./HoNClient-3.4.3.sh It should not be a problem of 32 vs 64 bits as both are included in this 2.3 GB file: I tested the md5sum of HoNClient-3.4.3.sh: $ md5sum ...


1

Command line applications will use a terminal anyhow. If you want to edit test.txt with vim, you still need to say which terminal you want to use. The full command you have to enter, assuming you run vim in gnome-terminal (using ALT + F2) is: gnome-terminal -x vim test.txt Than it works.


0

Try this changes: ANT_HOME=/home/computeruser/apache-ant-1.9.4 JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64 SDK_HOME=$HOME/adt/sdk PATH=$PATH:$SDK_HOME/tools:$SDK_HOME/platform-tools:$HOME/bin:$ANT_HOME/bin:$JAVA_HOME/bin export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting I removed some redundant path and I defined variable to improve ...


4

espeak espeak is a multi-lingual software speech synthesizer. sudo apt-get install espeak espeak "hello" spd-say spd-say sends text-to-speech output request to speech-dispatcher sudo apt-get install speech-dispatcher spd-say "hello" say say converts text to audible speech using the GNUstep speech engine. sudo apt-get install gnustep-gui-runtime say ...


0

From man spd-say: NAME spd-say - send text-to-speech output request to speech-dispatcher SYNOPSIS spd-say [options] "some text" DESCRIPTION spd-say sends text-to-speech output request to speech-dispatcher process which handles it and ideally outputs the result to the audio system. OPTIONS -r, --rate Set ...


0

fn+f9 if you are just looking for a keyboard shortcut and running ASUS... (I got here from Google looking for this feature so I know it doesn't address the question being asked but may help all the same).


2

Try using: gksudo -k -u root -- nice --20 gnome-system-monitor The double dash (--) signifies the end of the parameter list for gksudo, so it doesn't try to interpret the --20 as a parameter to gksudo. More information about this "bare double dash" can be found on Unix & Linux Stack Exchange.


0

I'll attempt to keep adding bits as you find them out. Getting files that contain something is fairly simple: grep -Rl demo . That will search the current path (.) for files containing "demo". If and when you know the path to the files you actually want to check, replace the . with that path.


4

last -t YYYYMMDDHHMMSS shows the status of the login files up to the date specified, rather than since the date specified.


0

some windows stuff can be on linux using wine or dosbox, but in general there is no known bat interpreter for linux. There are, however, implementations of various unix shells for windows, there's even a standard toolkit, Windows Services for UNIX (a.k.a. SUA), which include ksh implementation and many other nice goodies, so if you want it OS-transparent, ...


1

I installed dropbox from the app provided in the Ubuntu Software Centre and works well placing an icon in the top bar of the screen.


0

You can add the script to run at start with: sudo mv /sciptname /etc/init.d/ sudo chmod +x /etc/init.d/scriptname sudo update-rc.d scriptname defaults I would edit the script: #!/bin/bash sudo apt-get update > /var/log/updatelog sudo apt-get dist-upgrade -y >> /var/log/updatelog Then the output goes to the file /var/log/updatelog, so you can ...


-2

Yes, it is. You have to do some change: sudo visudo and add admin ALL = NOPASSWD: ALL where admin is your username. And to add your script to the startup program list you can see there Run automatically program on startup under ubuntu.


0

Here is what I did To solve this Problem- 1.Launched a same Hardware Like (the one that was messed up) instance. 2.Stop the messed uo instance. 2.ssh the complete ubuntu folder (Which had all the files needed). 3.Started the replica Server and ensured that everything worked fine.(We use Mongo ,Mysql,Tomcat and Java). 4.Once done I detached the elastic IP ...


0

The sudo command expects you to enter your password via a command prompt. Use gksudo instead, and you will be shown a GUI prompt to type your password in. So the command to add to your startup applications would be: gksu service network-manager restart You might also want to delay that command from running right away, to give your desktop a chance to ...


1

It was related to ordering of params. As assisted by @Muru ordering should be unzip -P$password "$source_file" -d "$destination_directory" Thanks.


0

I'm a little late to the party but here's my little contribution. Based on the previous answers , I have made a simple script batpower: #!/bin/bash # Description: Battery charge in percentage cat /sys/class/power_supply/BAT1/uevent | grep POWER_SUPPLY_CAPACITY The output for executing this ( ./batpower ) is going to be something like this: ...


2

There seems to be more than one issue: 1. Bug #1276348 ssh-agent is missing in backintime-kde in versions <= 1.0.34. Please install this patch with sudo patch /usr/bin/backintime-kde4 < backintime-kde4.diff 2. sudo vs. kdesudo sudo doesn't change $HOME but kdesudo does. $ sudo env | grep ^HOME HOME=/home/germar $ kdesudo env | grep ^HOME ...


1

I had exactly the same problem and solve it by installing dropbox following these instructions, but substituting nautilus-dropbox by dropbox. That is, I installed dropbox by executing these commands: sudo apt-key adv --keyserver pgp.mit.edu --recv-keys 5044912E sudo add-apt-repository "deb http://linux.dropbox.com/ubuntu $(lsb_release -sc) main" sudo ...


1

There's a command called arp-scan that might do the trick for you, you will need to install it first: sudo apt-get install arp-scan Here's a link to the man pages that will outline how to use it: http://manpages.ubuntu.com/manpages/trusty/man1/arp-scan.1.html As an example though, you could do this: sudo arp-scan --interface=eth0 --localnet Where eth0 ...


1

I don't know a way to actively scan a network for live systems, although I'm sure such tools exist. However if you just want to know what systems are connected and which MAC address they have I would just have a look at the list of active clients on your router/DHCP server. You can then enable MAC filtering on your firewall and white list the MAC addresses ...


2

I'd say you've found it in simple loops but you could do a number of things from here: Write a function to handle that for you function uberwatch { # syntax uberwatch <interval> <command> while true; ${@:3}; sleep $2; done } You could lodge that somewhere around your ~/.bashrc. Log the output to file but keep viewing with watch ...


1

x-terminal-emulator is a virtual package. The terminal emulator is configured by Debian's alternative system. On Ubuntu you can easily follow this symlink construction, e.g. for gnome-terminal: $ which x-terminal-emulator /usr/bin/x-terminal-emulator $ ll /usr/bin/x-terminal-emulator /usr/bin/x-terminal-emulator -> /etc/alternatives/x-terminal-emulator* ...


1

Use sudo apt-get install libudev1 if libudev.so.1 is not already installed then: sudo ln -sf /lib/x86_64-linux-gnu/libudev.so.1 /lib/x86_64-linux-gnu/libudev.so.0


1

Make the script executable with: chmod +x ./OculusConfigUtil_i386 Then run it with ./OculusConfigUtil_i386. Both errors result from the missing execute premissions.


1

You can try the following bash function #!/bin/bash function get_password(){ echo "Enter wour password: " read password if [[ -n "$password" ]]; then a=$(echo $password | tr -d "\n" | wc -c) b=$(echo $password | tr -cd "[:alnum:]" | wc -c) if [[ $a != $b ]]; then echo "Plz enter alphanumeric words" ...


1

If wine is installed on his PC the script is just: #!/bin/bash wine iTunesInstallerName.exe Put that together with the iTunes installer in a directory and tell him to run the script. It will start the installation process.


4

Use the built-in command history: history -w hist.txt will save the current history into file hist.txt. If you have write permsiions to the appropriate directory you could do something like: history -w /var/www/html/latest_history.txt Then your students could access it in a browser: http://teachers.ip.address/latest_history.txt


0

Host% is nothing but a prompt with host name (your computer name) saying that the shell is ready to accept commands. This prompt can be set to username or it can show time or date etc.


6

I open this question because it is got me interested. I did't know what is host%. But the answer is more easier then I was thinking. I'v google it and found this tutorial, where we can see this magically host%. This is so called Shell Prompt. Thing that usually appear before each command in terminal emulator. It is usually provide some information to user. ...


7

I assume you're seeing this host% in documentation. It stands for the shell prompt. ("Shell" is the program that reads the commands you type; "prompt" is the little bit of text that this program displays on your screen to say that it's ready to read your next command.) If you look at a terminal window on your computer you'll probably see something like ...


2

Use following command : watch 'ls -hal ./file|cut -d " " -f 5' And if you want to highlight difference than, watch -d 'ls -hal ./file|cut -d " " -f 5' This will give work as you want!


4

One option would be to escape the $ in your awk expression watch "ls -hal ./file |awk '{print \$5}'" Alternatively, you could avoid the issue altogether by using stat instead of parsing the output of ls watch stat -c '%s' ./file


1

Just to add a few points to the excellent answer by @Wilf, you can run commands in paralell if you want for any reason, for example, an autostart script for OpenBox might look like this: #!/bin/bash nitrogen --restore & tint2 & tilda This will set a background image using nitrogen, start the panel tint2 and start the Quake3-style dropdown ...


4

Simple really - you need to separate the commands. For instance this: #!/bin/bash sudo apt-get update sudo apt-get upgrade will update the package lists, and then the packages. Another possibility is this (probably better, as the && will only allow the upgrade command to run if the update exits successfully): #!/bin/bash sudo apt-get update ...


0

Try This [Desktop Entry] Type=Application Name=Minecraft Exec=java -jar /home/bbnorman/Documents/Files/Minecraft.jar Comment=Runs Minecraft. Icon=/home/bbnorman/Documents/Files/icon.png Hidden=false NoDisplay=false Terminal=false


0

I think your script doesn't have execute permission. chmod +x << your script >>


0

It looks like the output is going to the error stream, stderr - so redirect that instead of stdout: command 2> errors.txt Or redirect both together to the same file: command > errors.txt 2>&1 In case you want to know the whole thing - "jump into the rabbit hole" - see Illustrated Redirection Tutorial See also nohup - it's useful if you ...


1

Commands can produce output on stdout or stderr. The commands that you tried redirected only stdout. Under bash, you can redirect the output from both streams at once using: command &>test.txt & Or command &>/dev/null & If you are using a POSIX shell, then you need to do the redirection in steps: command >test.txt ...


2

To extract a .tgz file with tar you need to use, tar -xvzf /path/to/yourfile.tgz where, x for extract v for verbose z for gnuzip f for file, should come at last just before file name. You can use the following command in a terminal to unzip the file in your case, tar -xvzf /media/towhid/Amra/Software/Developing\ Soft/mongodb-linux-x86_64-2.6.3.tgz


5

Fairly importantly, I think you might not have an official copy of this and that could make what you're about to do pretty dangerous. The documentation for Nero 3 only talks about RPM and DEB installers. If you're confident your copy isn't going to destroy your life, carry on... Otherwise try to get hold of the DEB installer. It'll make things much easier. ...


1

Just press Ctrl + C to cancel any background process that may be running and then you can close the terminal without the popup showing up. Note: You can affect your system by closing the terminal with background processes running. A good example is if there is an update or upgrade running, the apt command can get locked up and you may start getting these ...



Top 50 recent answers are included