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

learn more… | top users | synonyms (1)

4
votes
2answers
120 views

How to get the current upload and download speeds in terminal?

I want the terminal to output the current upload and download speeds of my network connection. I do not want to monitor the speeds in real time. I just want a "static" value to be able to write it in ...
-1
votes
1answer
22 views

Bad substitution error in appending a variable to a filename (renaming file)

I tried to append a variable value to a filename and get the file name as: Page_variablevalue It gives bad substitution error when at line: mv "$page.txt" "page_${variablevalue}.txt" Please ...
1
vote
1answer
34 views

Change the user in bin/bash

I want a script X.sh to switch users and perform an action, but so far I have this: #!/bin/sh sudo su partner -s /bin/bash supervisord -c ~/supervisord.conf exit I want that the user partner ...
0
votes
1answer
28 views

Array Splitting in bash [on hold]

This following piece of code for constructing a sub array gives the output - sdf,sdf,sdf,sdf sdf,sdf,sdf,sdf But the expected output should be sdf,sdf,sdf,sdf sdf,sdf What is wrong with the ...
1
vote
1answer
35 views

How to edit /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts and similar files and why they can (not) be edited

I a trying to edit the following file (ls -alstr output): 0 -rw-r--r-- 1 root root 0 Apr 15 17:07 /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts Unfortunately, if I try to edit it with vim or simply ...
0
votes
2answers
28 views

Automating apt-get install with --assume-yes

I am trying to write a bash script to install a list of software. I am using --assume-yes to get pass the prompts This following line somehow doesn't work sudo apt-get install ...
-2
votes
1answer
29 views

what is wrong with this piece of code? [on hold]

The following piece of code where I want to check if an array is empty gives the error - re.sh: line 3: [0: command not found. The error is at the if statement. What is wrong with it? #!/bin/bash ...
0
votes
0answers
5 views

Startup script xrandr missing LSB tags and overrides please help

hello i have a simple script that looks like this xrandr -s 1680x1050 When i run it standalone it works! when i put the script into /etc/init.d/xrandr.sh I get the error "missing LSB tags and ...
1
vote
1answer
41 views

Bash script for execute one command for many files

I just tried to clear my holiday video stuff and found program for stibilizng vision. There are a lot of files so I made script to stabilize all. Firstly I need to run command: transcode -J ...
2
votes
1answer
38 views

Can't find binary file in path

folks. I've extracted a tar file with a few binaries into /usr/local/arm/bin and setup my path to include this folder. When I try to run which: $ which arm-elf-gcc /usr/local/arm/bin/arm-elf-gcc ...
6
votes
2answers
269 views

How to tell which parameter is being supplied to a command with a redirectioin operator?

This works: $ echo "notify-send HELLO" | at now This doesn't: $ at now < echo "notify-send HELLO" It says 'file or directory not found". I understand there's a -f option to this ...
4
votes
2answers
345 views

How to automatically launch bash shell when opening terminal or in console mode?

I create a normal user account in ubuntu using "useradd" command, but the problem is that I have to type "bash" to launch the bash shell for this user account in both the console mode (in a tty, ...
6
votes
2answers
208 views

Where is the bash history for the root user saved?

I'm not talking about .bash_history from my home directory. I usually prefer to use sudo -i or sudo su and then run commands as root user. Since, after these commands the history is not saved in the ...
0
votes
2answers
35 views

Why is this command starting endless terminals and how to make it work?

#!/bin/bash gnome-terminal --command='/home/user23/bin/n-youtube-dl "$1"' I want to pass the argument passed to this script to the other script started in the terminal. But this starts endless gnome ...
0
votes
0answers
37 views

How to enable lock screen button in Unity after installing xscreensaver?

I need this because I replaced gnome-screensaver with xscreensaver, so the lock screen button does not work. The alias path - may be the XY problem AFAIK alias is usually used to make 'shortcut' for ...
1
vote
1answer
45 views

Pause execution and wait for user input

I have a script that I am making and I have an issue with it: I would like to pause execution and wait for user input. I thought that I had it with the read -p -n 1 $foo command but the system is ...
3
votes
3answers
190 views

Explain this shell redirection: uuencode host-file < host-file >encodedfile

How the below shell redirection works ? Appears to be complicated to understand the order of execution. Any easy explanation ? uuencode host-file < host-file >encodedfile
0
votes
0answers
25 views

Absolute basic MQ wanted - command line driven

I am looking to install a very basic command line accessible MQ product. It will be run on Ubuntu 12.04 lts, and should be able to support multiple readers. Any products I should be looking at?
-3
votes
1answer
37 views

Scripting downloaded programs

I downloaded a game for fun and I would like to add it as part of my code for my butler program. Say I have the game moon-buggy and I would have this code run it. if [ $word = "buggy" ] then ...
2
votes
1answer
44 views

How can one run a shell script just before the desktop session begins?

I want my system to run with 1366x768 resolution. Note that this resolution is not detected by the open source driver. So I created a bash script as follows :- xrandr --newmode "1368x768_60.00" ...
2
votes
1answer
83 views

Bash completion for the new apt command

I like the new apt command (which will be included in the upcoming trusty release) so much that I installed it on my precise system by compiling the 14.04 package from source. Unfortunately, bash ...
8
votes
2answers
265 views

Can I enable bash-completion for the new apt command?

The new apt command in 14.04 seems to be a really useful intersection of functionality between apt-get and apt-cache but the current version of bash-completion doesn't know about it... Which makes it ...
9
votes
3answers
711 views

what does -x mean in if conditional statement?

what does -x mean here: if [ -x /etc/rc.local ] then How could I find out this manual page for if?
0
votes
1answer
36 views

su to different user no longer working in 12.04 LTS

I want to log on as tomcat7 user in a different bash command shell. I used to be able to do this by doing the following: sudo su - tomcat7 But when I enter this command now I get returned to the ...
0
votes
1answer
12 views

Changing .bashrc to allow a call to “android” from any directory

I can successfully do the following command in the directory listed kn@MrComp:~/.android_os/adt-bundle-linux/sdk/tools$ android list targets Available Android targets: ---------- id: 1 or ...
1
vote
1answer
44 views

Why is 'sudo bash' a bad idea? [duplicate]

Anyone want to comment on sudo bash in comparison to sudo su and sudo -i? I know sudo -i is the preferred because "environment". I've gotten into the bad habit from years ago when I was a kid in a ...
3
votes
1answer
33 views

Append current timestamp on files name from background running command

Following is command that I have used in bash script and it is run on background: sshpass -p prakash12 ssh -t -p $1 prakash@localhost './test_new_update_script.sh > ...
1
vote
1answer
97 views

Difference between 'grep' in Ubuntu and Kali Linux?

I always used the following command to filter out my contacts email addresses from a directory in Kali Linux: grep -rIhEo "\b[a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9._-]+\b" >> 1A I tried ...
1
vote
2answers
18 views

Bash/zsh: Undo erase backwards (ctrl+w)

In Bash and Zsh ctrl+w erases backwards from where the cursor is. Is it also possible to undo what I had erased? Thanks!
0
votes
2answers
30 views

lscpu output differs when called indirectly?

I use lscpu | grep 'MHz' to get my clock speed. I am getting different results based on the method I am calling this command. Method 1: typing it in the terminal CPU MHz: 1200.000 Method 2: ...
0
votes
1answer
36 views

Why do I need to run “/bin/bash --login”

I have just setup a new Ubuntu 13.10 server with ruby 2.1.1 installed through rvm. The problem is that whenever I switch to the user "rails" (the user I installed ruby and rails with) I have to run ...
8
votes
5answers
454 views

Is there any manual to get the list of bash shortcut keys?

There are many shortcuts that I use while interacting with bash command line to make the work easier and faster. Like: ctrl+L: to clear the screen ctrl+a/ctrl+e: to move start/end of the line ...
1
vote
2answers
174 views

How would I make a program go back to the start.

So I have my program and I cannot figure out how to make the program loop back to the start. I have more of a program however this is the part where I would like the program to restart if I picked yes ...
-1
votes
1answer
35 views

getting highest value in files and storing the next values as per desired count

let us say i have counter, which is variable. For clarity, counter = 3. And I have files with different values: file 1 3 4 8 file 2 2 3 4 5 file 3 11 13 15 file 4 19 29 34 my ...
1
vote
1answer
81 views

Why doesn't this bash script execute on Ubuntu, but does on an online environment?

I can't figure out why this does not work properly on Ubuntu. It works great when I execute the script on CompileOnline; but when I run it on a local server it does not give me the main menu and skips ...
1
vote
1answer
29 views

zip I/O error: Protocol error in bash script

so here's the script that i am trying to get it work: #!/bin/bash filePath="$1" fileName="$( basename "$filePath" )" backupDir="/my/backup/dir/${fileName}-backups/" dateTime=$( date ...
4
votes
2answers
271 views

'tail' command not getting only the new lines

I'm using the command: tail -f -n 0 file.txt But it keeps repeating itself. What I'm doing is the following: Create the file in the first terminal: touch file.txt Start the tail in the second ...
3
votes
4answers
171 views

How to tar the n most recent files with spaces in filename?

I am trying to create a script that foreach directoy in the folder folder, only the n most recent files are to be compressed. However, I am having trouble with the multiple word files. I need a way ...
0
votes
1answer
20 views

Crontab backup not working (not generating log)

I want to run a script every day at a certain hour, so I saw that I could use cron for that. Following the tutorial, I edited the crontab file like this: crontab -e and added: 26 13 * * * ...
2
votes
1answer
29 views

Bash script to tar a folder saves basepath

My script tars a folder in my /home/user directory and saves it all in a backup folder. However, when I open each of the tar.gz all of them have the directory /home/user and then the folders and files ...
0
votes
1answer
24 views

Mouse turns off after a few seconds (Ubuntu 13.10, Windows 8.1)

I tried lsusb and I can see my mouse in the list. I tried for foo in /sys/bus/usb/devices/*/power/level; > do echo on > $foo; > done But I got this reply bash: ...
0
votes
1answer
25 views

How to edit displayed bash name [duplicate]

I've done some googling, and looking around this stack overflow, but this one seems to elude me. How might I reduce/edit the displayed bash name on the terminal prompt? I.E. This: ...
1
vote
3answers
39 views

do,while in bash

I want to get RX and TX from each network adapter, so to get RX and TX from one network adapter, i used this commands : cat /proc/net/dev | grep 'wlan0' |awk '{if ($2) print $2}' | awk -v ...
0
votes
2answers
52 views

Create a file and write to it [closed]

Trying to create a file auto.home under /etc and write this to the file: 192.168.56.101:/NFS/home/& I am not doing it with commandline, but bash script. Tried this but didnt work: cat ...
0
votes
2answers
39 views

Starting bash from /usr/bin/env or /bin

Which would be advised as the first line in a bash script: #! /usr/bin/env bash or #! /bin/bash
-1
votes
1answer
36 views

Environment Variables and .bashrc [closed]

I need Help in this: that is how to do this Edit the setting file of the user. In our case it should be in the root directory of the user and the name is .bashrc or .bash_profile 2.- Add the ...
0
votes
1answer
44 views

sort first by type second by the youngest birth

In my Download folder I have a lot of files.I need first a way to arrange them by type second files with same type arrangement become by the type that i added(or can say downloaded or birth (if i am ...
3
votes
2answers
260 views

Add strings to a file with commands

I need to add: user_xattr,acl,barrier=1 to my /etc/fstab file. Is there a way to do this via the via shell script? I only want to edit the '/' mount. Here is what I have before I manually edit ...
-1
votes
1answer
33 views

bash excecuting each line of file and checking for sucess

I had a file with variable number of lines, and each line is a command, say, file1.txt: command1 command2 command3 My intention is to execute each line, and report "good" if the command is sucess. ...
0
votes
2answers
50 views

Calculating the number of lines in a file?

How would i calculate and display the number of lines and words that are contained in a .sh file