Bash is the shell used in Ubuntu's command-line interface.

learn more… | top users | synonyms (1)

-4
votes
1answer
19 views

Need help in writing Bash code to extract lyrics from link for school assignment [on hold]

I need help to write code to extract lyrics from a website for my school assignment. The website link is: http://www.lyricsfreak.com/b/bob+marley/aint+no+sunshine+when+shes+gone_20525681.html Here ...
1
vote
3answers
77 views

Using sed to add text to a file before and after word

I have a file with words, one word per line, which I now want to change so that is becomes a .sh-file with an egrep-search string for each word. The search string I want in the end looks like this: ...
0
votes
1answer
13 views

Chromium app closes after executing the bash script by double click

I have a chromium app which i want to execute from a bash script. I am successfully able to execute this command from terminal and able to open the app but when i tried to double click the script the ...
0
votes
1answer
99 views

Ubuntu Terminal Command “cd -” makes a Loop!

Well I am fairly new in Ubuntu world. New to Terminal too. Asfaik I can use the command cd - to go back to the previous directory. Now lets say I am in a directory which is home/dir1/dir2/dir3/mydir. ...
-1
votes
0answers
34 views

Bash to copy lines in file [on hold]

the file I am working with looks like this (only the last two lines are shown) [16]((((((((((648:0.0167313,(((839:0.00281972,903: [62](((909:0.00419522,895:0.00419522):0.004454hgip: 76898 how could ...
2
votes
1answer
36 views

How can I ignore errors with specific keywords in bash?

I am aware that I can ignore ALL errors like so: command 2>/dev/null But I want to ignore only specific errors. For example, if I run: cp file I get the error: cp: missing destination file ...
2
votes
4answers
79 views

Tally up results from a grep search?

Say I have a list such as this: 8 382.34.6 sally sally 8 923 183.3.3 183.3.3 183.3.3 8 And I want to tally up the number of times each unique value repeats and get output like this: 8 3 382.34.6 ...
1
vote
0answers
18 views

System freezes during Bash auto-completion with Tab or Ctrl+R

It started about a week ago, don't know why. Now, when I type something like cd somedir and click Tab, my system completely freezes for about 10 seconds. I can move the cursor but can't switch between ...
1
vote
1answer
26 views

Parse file for recursive pattern

in my dir there are several files with the pattern simulation_y_t for all files with this pattern I would need to check whether in the last line of the file the word hgip comesup or not ...the ...
1
vote
0answers
25 views

Making tab completion look anywhere in the word

This completion mode probably has a name, I just don't know what it is. In Sublime Text the auto complete works in a way that the typed letters are searched for in the same order but they are not ...
4
votes
1answer
27 views

Use the bang-commands (e.g. '!!') of bash in scripts and aliases?

Is it possible to use the so-called bang-commands (! + command/symbol, like e.g. !! or !$:p) in bash scripts and in bash aliases? I wanted to add the line alias getit='sudo apt-get install !!' to ...
-1
votes
2answers
29 views

Name files after split command

there is a large file I split in bash. I am using split -l 20000 -d "job1" "job1" where job 1 is the input file - how can I change the naming of the output so that it produces ...
2
votes
2answers
23 views

how to pipe output of traced bash debugging?

I want to pipe the output of traced script as follows: bash -x /path/to/a/script | more or bash -o xtrace /path/to/a/script | more and bash -x /path/to/script > a_file or bash -o ...
0
votes
0answers
23 views

Error executing “./configure” command : bash: ./configure: No such file or directory

I have downloaded CiscoPacketTracer6.2.tar.gz file. Now I want to install it. The command I have use is tar xvfz CiscoPacketTracer62Student.tar.gz Then I navigate to that directory using cd ...
1
vote
0answers
40 views

Script with xdotool not working properly on a fresh reboot

I want to run streamus (chrome app) to stream youtube from terminal and asked a question relating to that in this same SE. I also got a wonderful answer and a script for my problem. But that script ...
11
votes
3answers
2k views

What is the meaning of the following code?

Can anyone explain what does this command mean? PATH="${GZIP_BINDIR-'/bin'}:$PATH"; export PATH
4
votes
1answer
135 views

Delete lines in several files in a folder once (avoid infinite loop)

I have several files in one folder, and I want to delete the first lines in all of them. If I do this: sed -i.bak '1,2000d' *.dat the first 2000 lines are deleted, but then the filename is still of ...
0
votes
1answer
36 views

I want to write weather data via a python script twice a day to a csv file [on hold]

Is this practical? How do I accomplish it? Some barriers I've come across already: I have separate scripts for weather and time. How do I format them into one comma-separated row? how do I print ...
1
vote
1answer
57 views

How to run streamus app from terminal

I use Streamus to stream music from you tube. I want to know whether streamus can be started from terminal itself. I have asked this question in main software site and the author recommended to use ...
0
votes
2answers
45 views

Difference between C programs and shell scripts receiving signals from fuser

I have written the shell script below for a lab in my college. It must look at a log file being upgraded frequently from another process and create a number of copies passed at invokation. Here is the ...
3
votes
3answers
68 views

Move files from specifically named folders / move files up one level

The goals is to move files out of the lowest level folder, back up one directory. This does a great job but moves files higher up the folder hierarchy as well. find . -name '*.jpg' -type f -execdir ...
0
votes
2answers
28 views

How can I use convert to resize images to a specific width keeping the ratio for the height? [duplicate]

I have a file with the full path to an image on each line, all are jpg. I want to resize every image/line in the file to 1024px in width, while keeping the aspect ratio for the height. I simply want ...
5
votes
1answer
34 views

Help with Alias [duplicate]

I frequently use: find /home -iname foo* 2> /dev/null The 2> /dev/null suppresses any permissions issues and leaves legit matches. I tried creating: alias lost=find /home -iname ${1} 2> ...
0
votes
1answer
38 views

running python packages from user local directory

I'm on a Shared hosting, with a limited SSH access. don't have sudo privileges. And there are some limitations on some folders, as the following: This is the output of the termial ls -al : ...
0
votes
0answers
36 views

shell script in /etc/profile.d not running at startup [duplicate]

I have a shell script at /etc/profile.d/pg_local.sh. It contains the following contents: export PATH="$PATH:/usr/local/pgsql/bin" Its supposed to load that path in the user accounts' $PATH when the ...
0
votes
0answers
18 views

Pass to the script keyboard key pressed after hotkey has invoked a Bash script

I assigned a custom hotkey Ctrl+Q to launch my bash script. #!/bin/bash read -s -n 1 key zenity --info --text "$key pressed" I'd like to have a script to detect which key followed the hotkey. Say ...
0
votes
0answers
9 views

Inotifywait is moving multiple ffmpeg segments instead of one at a time

I have come to a dead end looking for a solution on my own and will ask for your help please.... Thanks for all info you may have.... I capture 30 second segments of video and write to a folder in ...
46
votes
5answers
3k views

What does “apt-get install !!” do and how to make it work?

I have seen someone typing apt-get install !! He did that a few times and every time, a different program was installed. It seems like it automatically figured out what is needed next. However, ...
0
votes
2answers
13 views

Permission denied error during “hadoop namenode -format” command

I am trying to install single node hadoop cluster using this tutorial. I followed all the steps as mentioned the above link says but I am not able to format the namenode using command hadoop namenode ...
1
vote
2answers
44 views

Unzip a file to its current directory

I've figured out that extracting a .zip you need the path to the directory as well when you are recursively looking through subdirectories. So how do you store the path? This is nearly there but ...
3
votes
3answers
128 views

Store a filename in a variable minus the extension

File: test.zip Bash script while read filename; do zip_file=${filename} # do stuff done; Value stored in variable = "test"
0
votes
1answer
28 views

no echo in bash shell script loop

In this script, the second echo statement doesn't do anything. #!/bin/bash echo "Start folder create..." find . -name "*.zip" | while read filename; do foldername="${filename%.*}"; mkdir -p ...
2
votes
1answer
118 views

Shell script with select command to show a list of files

I've written the attached bstls.sh shell script which uses the command select to choose the subfolder or file in a folder passed as argument on which execute the ls command. #! /bin/bash #Personal ...
1
vote
1answer
45 views

Printing from command line

Please can anybody explain what exactly these commands and options do: find /home/mike/Duck/ -type f -iname '*.txt' -print 0 | while IFS= read -r -d '' f; do lpr "$f" && mv "$f" ...
0
votes
0answers
49 views

How to add and pass system password as a variable in a script

I have a script which asks for system/login password and pass that password to further processing. This is the gist of programm by which I am executing my script. read -s -p "Password: " password1 ...
1
vote
1answer
32 views

Installing software on another computer with bash

I'm relatively new to all things Linux, but I've missed out on two really good job opportunities because I lack Linux experience. To that end I've been playing around with Ubuntu and Centos on some ...
0
votes
3answers
135 views

How to download facebook videos by using 'youtube-dl' in linux?

I am unable to download facebook video using youtube-dl. The following error occurs during downloading $ youtube-dl ...
4
votes
1answer
77 views

How to execute a sudo script with double click

I have this script to shutdown my system after 30 seconds. I want to run this script by double clicking it (that option I changed in nautilus). This is the content of my script #!/bin/bash shutdown ...
4
votes
4answers
171 views

Blocking Start of Terminal

If you type this simple test command: gnome-terminal -x bash -c "ls;sleep 3" You will find that it returns immediately (the newly created terminal, of course, lingers for three seconds). This is ...
0
votes
1answer
41 views

error in running bash script as root

I have a simple shutdown script which i want to run as root shutdown -h +30; echo "succesfull"; I have followed these answer1,2 to make my script root. first I run this command sudo chown ...
0
votes
1answer
31 views

How to maintain a counter across multiple executions of a script?

I have a script with a conditional statement and I want to find out how many times the then clause is executed, across multiple runs of the same script. eg: if [condition] then Some code; ...
1
vote
1answer
18 views

Find ports locked to process running in the background

Is it possible to find the ports assigned to the process started on the background? I want to start a process and let it run in the background, like ./run.sh & and then see all the ports this ...
3
votes
2answers
126 views

Can alias command pass arguments?

I want to know if i can pass an argument with an alias command. for example: alias d="dmesg|grep -iw usb|tail -5" Now d will print the last 5 lines. if i want to use d to print a different number ...
1
vote
2answers
22 views

Calling Values from a .properties file?

Right now I have a simple script I want to now call a .properties file and then print the results of that file, this is what I have so far #Specific Set Variables SpecficStatus="Pass" #SetVariable ...
0
votes
2answers
33 views

I need to make a batch of users

I had written some code that would allow me to make a batch of users based on a file with usernames in it. But it eventually went from just a few lines to about 50, and I deleted it. There has got to ...
1
vote
1answer
24 views

Can't find an installed program - mathematica

I recently installed Wolfram Mathematica as a .sh file. I ran it using bash and it took me through installation. It said that the installation directory should be /usr/local/Wolfram/Mathematica/10.1 ...
3
votes
2answers
44 views

grep regex pattern causes unexpected command behavior

I'm searching for lines with $ and consecutively ' or " through this grep in my terminal: grep "\\$('|\")" -rin folder_path After pressing enter the terminal doesn't think the line is complete so ...
1
vote
1answer
19 views

bash expressions

In a bash script I have the following section. if [ "${1:0:1}" = '-' ]; then set -- mongod "$@" fi What does the expressions ${1:0:1} and set -- mongod "$@" ?
1
vote
0answers
17 views

Screen in crontab

I'm trying to run 9 screens windows by crontab, and then, run some codes (basically the same for all of them), but they don't work. The code runs all of 9 screens, but run code only on the first. Aah, ...
9
votes
2answers
569 views

Piping to “type” command

I want to find out the type of several commands. Is it possible to pipe or xargs a search result from find into the type command in Linux? For example: find . -name anacron | type or find . -name ...