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

learn more… | top users | synonyms (1)

1
vote
1answer
285 views

Application autostart after system boot for a random interval

Reading 'sleep' mans and googling haven't provide any useful information. I want to run Pidgin after Ubuntu boots, but after some time left. For example, logon is passed, and after interval for 1 to ...
2
votes
2answers
109 views

Editing a command-line argument to create a new variable

I have a bash script called test.sh that uses command-line argument: lynx -dump $1 > $name".txt" But I need name to be created from the argument by specific keywords in the argument. An example ...
2
votes
1answer
425 views

Bash does not remember programs with non 0 exit status in history

I enter a command. It fails. I press arrow up, modify something and enter it again ... hold it right there. It used to work like that. Now it's more like: I enter a command. It fails. I press arrow ...
0
votes
1answer
552 views

Usings xargs in Terminal with a bash script

test.txt has four urls in it. urls.sh: cat test.txt | xargs -n 1 check.sh uses command-line arguments for its url variable. In Terminal, what do I write so that all the urls can be checked with ...
5
votes
3answers
245 views

How to change the color of particular file?

I want to change the color of particular file type: for .c files red for .out files green for .sh files orange Like this, how to make these colors as default color for the corresponding file ...
1
vote
1answer
539 views

collecting data, saving it into a file and rerun it again in bash script;

I'm new to bash and have written this script to collect data then save it to an automated file. It runs fine til here but as I try to rerun the script to add another details it gives me errors. ...
4
votes
1answer
428 views

How to run some alias command in bash's non-interactive mode

I want to run some alias command in bash's non-interactive mode. But seems Ubuntu ignore BAHS_ENV. How can I make it work? la is a alias command. And I tested in other linux. it is work fine. Just ...
4
votes
2answers
3k views

How to check how long a video (mp4) is using the shell?

I need to ftp upload all the mp4 files in a directory with length > 4 minutes using the shell. I can't find any script to check how long a video is. Does anybody have any idea how to do that? Thank ...
4
votes
4answers
4k views

How can I make ssh-copy-id use a port other than 22?

How can I make ssh-copy-id use a port other than 22? I tried it with -p but I get: ssh-copy-id -p XXX XXXX@XX.XX.XX.XX Bad port 'umask 077; test -d ~/.ssh || mkdir ~/.ssh ; cat >> ...
2
votes
2answers
5k views

How do I include a password with SSH command? (want to make shell script)

I'm trying to SSH to a server on startup with a .sh script, but that will require me to enter the password for the account on the server that I'm SSHing to. I did some RTFMing, and I see in "-o" that ...
3
votes
1answer
193 views

find changes in directory script

I am trying write a script to find all changes (modify,create,delete) in a list of directories for last 24h, as the following : #!/bin/bash LOGDIR=change_log FILETYPE=*.php DIR=www ...
9
votes
3answers
42k views

How do I create a script file for terminal commands?

In Windows I can write a file containing commands for cmd (usually .cmd or .bat files). When I click on those files it will open cmd.exe and run them commands the file contains. How would I do this ...
3
votes
1answer
9k views

Can I log in with other user's account?

I would like to ask you about login command in bash shell Ubuntu. I entered #login then it asks me about username and password. Is this a way to log in with other user's account?
1
vote
1answer
292 views

how to remove environment variables set for QSTK?

I am new to Ubuntu, and I'm having trouble with the terminal application. Every time I open it this message appears: "bash: /home/xxxxx/.bashrc: line 1: syntax error near unexpected token `(' bash: ...
1
vote
1answer
97 views

Lower casing and truncating a variable in a shell script

I am trying to convert a variable to lower case and strip a suffix at the same time. The variable contains a file name and I am stripping the extension: for f in *.shp; do echo ${f%.*};done To ...
1
vote
2answers
4k views

Library missing for executable file

There's an executable I downloaded onto my Ubuntu 10.04 and I can't run because it's missing a library. I have also tried compiling the source with CMake. This is my Terminal output: ...
4
votes
1answer
2k views

How to detect image dimensions and run commands on them?

I have a directory full of images, some of which are portrait-sized instead of landscape-sized, and I want to open the portrait-sized ones with an image editor. I can run the imagemagick command ...
9
votes
2answers
13k views

how can I batch extract audio from mp4 files with ffmpeg without decompression (automatic audio codec detection)?

I have 228 mp4 files (2.6GB) and would like to extract audio from them (mp3 or ogg). I want to batch extract them - preferably with bash. I'm not sure if all files use the same audio codec as they ...
3
votes
1answer
73 views

Altering the prompt

Ok, so i am trying to create an alias, that would allow me to set the current directory in the terminal, the base directory to be displayed in prompt. Let's assume the alias is named basedir For ...
4
votes
3answers
346 views

bash escaping and find command

I trying to remove boring \-escaping from this command: find . \( -name '*.mp3' -o -name '*.jpg' \) -print by wrapping it in single quotes: find . '( -name *.mp3 -o -name *.jpg )' -print ...
1
vote
2answers
2k views

Multiply with decimal numbers in bash [closed]

When i run p=0.1 k=2 while [ $p \< 1 ] do echo $p p=$(echo "scale=2; $p*$k" | bc) done i have this result 0.1 .2 .4 .8 What can i do to have 0.1, 0.2, 0.4 and 0.8 ?
3
votes
2answers
3k views

Bash script to automate truecrypt volume creation, mounting and unmounting

I am trying to code a bash script that will automate the several tasks related to truecrypt. Tasks are: Creating a truecrypt volume, mounting it, copying a file in filesystem, modifying the file, ...
4
votes
2answers
90 views

How do you print/recall the definition of a function in bash

I can define and print the contents of variable called my_var like this: my_var="hello" echo $my_var but if I define: my_funct {echo "hello";} how can I recall my function's definition later on? ...
0
votes
1answer
5k views

“Text File Busy” when running a simple script on bash

When I make a simple script, I get "Text File Busy" when I try to run it. dbell@det-ui-supergbe:~$ cat > test2 ls ^Z [2]+ Stopped cat > test2 dbell@det-ui-supergbe:~$ chmod a+x ...
1
vote
1answer
241 views

Are $ reboot and $ shutdown -r now different?

I was receiving the following notification at the end of my message of the day *** /dev/xvda1 will be checked for errors at next reboot *** I did the following $ touch /forcefsck $ shutdown -r now ...
5
votes
4answers
676 views

How can I prevent accidental execution of the rm -r *command?

Occasionally I use command to delete some files. For example, the name might start with 'a', so I'll delete with the command rm -r a*, but I don't want to remove some other directory by accident. How ...
0
votes
1answer
1k views

Gedit not Launching

For some reason, gedit does not launch. Here is the output it gives: chris@Chris-Ubuntu-Laptop:~$ gedit chris@Chris-Ubuntu-Laptop:~$ Descriptive, Let us try the help. chris@Chris-Ubuntu-Laptop:~$ ...
2
votes
2answers
316 views

Does sudo really make you root for a while?

On Ubuntu, in what kind of situations, if any, running a command as a non-root to access a file/folder or create/delete a file/folder using sudo may result in "permission denied" while running the ...
4
votes
2answers
1k views

How can i make the PC make a 'beep' sound when network cable is unplugged?

How can i make beep sound in the PC when the network cable is unplugged or no network available to any specific interface such as eth0 or eth1? Follow up: $ sudo apt-get install beep $ cat ...
2
votes
3answers
2k views

can I redirect file as input to notify-send?

I want to use command notify-send and display text from a file as a notification so that I can only edit that file to change command or forward contents from outputs of other programs to notify-send. ...
1
vote
1answer
1k views

How can I capture text from a specific terminal and redirect it to a log file while simultaneously working? [duplicate]

I viewed this question to redirect text to file while displaying the output. My question is how can I redirect it while working AND without constant | tee command. My plan is to use this question to ...
3
votes
4answers
812 views

How to xkill an application by its id?

I need to simulate the behavior of the keyboard shortcut (ALT+F4) using Terminal for a given application. If I open for example gedit and click ALT + F4 , then GEDIT will be xkilled. If I want to ...
2
votes
1answer
275 views

Run Bash script before every print job

I'm using refilled printer cartridges that don't show ink levels, so I made a bash script that keeps count of printed pages (from CUPS log) and shows a warning when it reaches about 200 pages (known ...
1
vote
2answers
135 views

download file from web source, selectively

If anyone has heard of Bukkit, you know that their files are usually of three types: Development, Beta, and Realease. Click (here) for examples. I need a script that: Loops through the directory ...
0
votes
1answer
380 views

How to check for missing files in filesystem or directory with bash (after crash)?

After the system unmounted the root partition, I detected that some files are missing in the filesystem. wifi and the gwibber icons disappeared from the indicator applet I am trying to check if ...
3
votes
4answers
6k views

bash profile works for user but not sudo

I've modified my .profile to include a folder if a flash drive is plugged in. When running the command as the user it works fine but tells me the scrip must be run by sudo (this is what i want). ...
1
vote
1answer
142 views

Unity Icon for a bash ran program

So I downloaded the .tar.gz for eclipse, extracted and set it up. I created a .desktop file so I could dock it in unity. I then want to be able to have a bash script open the program from the ...
27
votes
9answers
83k views

How to move multiple files at once to a specific destination directory?

I got a bunch of files in some directory (along with many other files) that I want to move. Luckily, all the files I want to move contain a certain identifier in their names, so I can ls | grep ...
0
votes
2answers
645 views

How to delete older files using a bash script?

How to find and delete older files (older than 7 days) in a folder using a bash script? It's a folder in a server which contain automatic backups. Need to delete old ones automatically so there's ...
7
votes
2answers
3k views

Setting Default Byobu screens

I've just installed Quantal as a fresh install, and want to set up Byobu as it was on my old system. In a previous version of byobu there was an option in byobu-config (via the F9 key) to create new ...
3
votes
3answers
3k views

Cannot use “./” to execute a shell script

Maybe someone here would be able to help me out. Have installed Ubuntu 12.04 LTS (kubuntu) on two machines. The .bashrc and .bash_profile files are identical as the file structures on each machine is ...
1
vote
1answer
2k views

Permission Denied Error when trying to reload ~/.bash_profile

Hello people I am trying to reload the "~/.bash_profile" but I get the "Permission Denied Error" and "sudo" does not work is there a way I can reload the "~/.bash_profile" because it's an integral ...
0
votes
0answers
134 views

/etc/bash.bashrc executed but not ~/.bashrc [duplicate]

The bash man page says: "When an interactive shell that is not a login shell is started, bash reads and executes commands from /etc/bash.bashrc and ~/.bashrc, " I can see that bash.bashrc is executed ...
2
votes
2answers
689 views

How to reset bash keyboard shortcuts?

How can I reset the bash shell's Ctrl + C keyboard shortcut? I changed it a few months ago and can't seem to recover it.
1
vote
1answer
1k views

Get working directory of terminal, not the script

I have a script that i want to create files, depending on the directory the user (me) is in (it can be called from command line). However, it creates the file in the same directory the script is ...
4
votes
3answers
3k views

How to retrieve tweets from command line?

Is there a simple way to retrieve someone's tweets from the command line? The account would be public, and the command - or script, if necessary - would retrieve all or a specified number of most ...
4
votes
1answer
241 views

Adding new commands

I have added some new commands to ~/.bash_profile but every time I start a new terminal session, it seems to forget these commands and I have to do . ~/.bash_profile again. Is there a way to avoid ...
5
votes
1answer
327 views

Git autocomplete is asking for a password, not sure why

I'm running into an issue with autocomplete using git... I am using ubuntu 12.10 and when I perform the following keystrokes g i t Space Bar Tab I am presented with the error Pseudo-terminal ...
2
votes
1answer
3k views

What can cause my .profile file to not be loaded when a new terminal shell is initialized?

There are no errors in xsession and I don't have a .bash_login or .bash_profile file, so I'm 100% certain neither of those is loaded and thus cancels .profile loading. When I rename the .profile to ...
17
votes
5answers
12k views

auto-completion does not work for “sudo apt-get install”

Okay a college of mine just showed me that you could do sudo apt-get install <type first letters of package> <TAB> That it auto-completes the name of the package. Just for an example... ...