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

learn more… | top users | synonyms (1)

7
votes
1answer
2k views

VLC “:rate=2.0” - Where do I put this in command-line?

I figured out a way to transcode my videos so that they would play at double speed using the GUI as "Convert/Stream" --> "Show More options" and adding :rate=2.0 after :file-caching=300 in the "Edit ...
1
vote
1answer
132 views

How to use ' and " (quotes) as an argument

Intro In a script I want to run a command in a separate window so that output of the command will show in a new window (which is an output stream like top) and they do not interfere each other. For ...
2
votes
1answer
2k views

Permission Issues with command in rc.local

I am using a command to start a screen session and run a bash script for a user. /bin/su username -c "/usr/bin/screen -dmS test bash -c '/home/username/test.sh; exec bash'" When I boot, I am seeing ...
38
votes
2answers
12k views

Bash: delete from cursor till end of line with a keyboard shortcut

Consider the following bash prompt, where ^ denotes the prompt location: # git commit -am "[bug 123456] Do this and that with the bug" ^ Suppose that I want to commit ...
2
votes
0answers
171 views

Running bin file in bash script [closed]

I want to build a bash script that runs a bin file. However the question is: how to continue the script even after bin operation is completed to perform other commands?
3
votes
2answers
1k views

How do I run a py file with pico in the terminal?

I got this when I tried to open a .py file on the terminal line I edited in pico: lightning@rigel5:~$ ./hello.py bash: ./hello.py: Permission denied How can I easily open a .py file from the pico ...
3
votes
2answers
5k views

Copying from mount share drive to local folder through script

This is my first time trying to work with Linux Scripts so this may be something obvious. Here is what I am trying to do: Remove all contents from local folder - rm /home/user/Documents/Exercise/ ...
2
votes
2answers
75 views

How to port the bash settings?

I want my own bash environment vim tmux and so on, that I can customize for my develompment needs. Then upload it to github and install whenever I set up my computer new. Any HowTo's how to proceed?
3
votes
2answers
771 views

Using read without losing the TAB

Im using read in a while loop to automatically change a makefile after download. Here is part of the script, while read a; do if [[ "$a" = "FCOMPL=g77" ]] then echo "FCOMPL=gfortran" ...
14
votes
3answers
1k views

How to make username in terminal smaller?

When you opens a terminal it displays the username and the machine name. As an example mine shows: romeo@romeo-Satellite-C660D:~$. It's really annoying because it's kinda big. Can i make this smaller, ...
4
votes
1answer
11k views

Why does “if [ 0 ]” execute the “then” statement in bash script?

This guide says: An if/then construct tests whether the exit status of a list of commands is 0 If I execute 0 in the bash, it says: 0: command not found So its exit status is not 0, and [ 0 ] ...
1
vote
2answers
87 views

How to create a bash file allowing a folder from CD be transferred to Documents?

i want to transfer the myfiles folder from CD to Documents in a more decent way of transferring. I think creating an executable bash file is better. this bash file when clicked will allow the ...
3
votes
1answer
299 views

Saw an interesting command but can't alias it

Saw an command from this post http://askubuntu.com/a/266839/75967 that I would like to alias find {,/usr}/{,s}bin -printf '%f\0' | xargs -0 whatis | sort | less I assume the less or the | is ...
0
votes
1answer
231 views

Create bash with xinetd

I'm making an intentionally vulnerable Ubuntu server for an information security class. I'm trying to create a bash shell that is accessible without authentication, a user should just be able to ...
0
votes
2answers
770 views

Fix bash_profile to Develop Ruby on Rails Apps

I just installed Ruby and Rails stuff on my machine, and start to learn. But every time I close the Terminal and re-open it, I have to re-type the command . ~/.bash_profile in order to run Rails ...
0
votes
1answer
398 views

Command line FTP download latest files

I am trying to use the command line ftp to download files from a specific date and onwards. Is there a simple solution for this? Thank you!
0
votes
1answer
562 views

Does adding a folder to your classpath add sub-folders?

I am doing this in a script: if [ -d $SERVICE_HOME/../config ]; then CLASSPATH="$SERVICE_HOME/../config:$CLASSPATH" fi And the /config folder has sub-folders in it also, will files in the ...
3
votes
2answers
358 views

How to run a bash .sh after starting a program in PlayOnLinux?

I have a little script that needs executing every time I open a wine program. The script is pretty simple: #!/bin/bash xdotool windowmove 67108871 1440 0 How do I get PlayOnLinux to run this script ...
2
votes
4answers
5k views

Minecraft server (Bukkit) .sh bash file not opening

My Minecraft server (Bukkit) .sh bash file is not opening! I did make it executable (in permissions, I clicked "anyone" for executable). Here's the code: #!/bin/bash cd "$( dirname "$0" )" java ...
0
votes
2answers
2k views

Inserting variable into sed command in bash script

I have text file similar to this: Some-text Keyword Some-text Some-text Keyword Some-text Keyword Keyword I want to replace every "Keyword" with "number.extension" where number is 1 at first ...
5
votes
3answers
3k views

How can I shorten the bash prompt's current path to one letter per directory?

I can't remember where, but I've already seen the bash prompt's current path shortened in an interesting way: every directory contained in the path (excepted the last one) is replaced by its first ...
0
votes
1answer
811 views

Bash command: ls -lah not showing /etc directory?

Ok guys, elementary question. I was poking around my server, and I noticed that when I 'ls' the / directory, /etc folder is not displayed. Why is that? I can very easily cd into it, but why is it ...
1
vote
1answer
665 views

bash script : is it possible to recognize video format from files (to batch extract audio from them)?

I have written a little bash script to extract audio from video files in batch mode. Sound is extracted from each mp4 file to flac format using avconv (and the flac codec). #!/bin/sh # # Batch ...
4
votes
4answers
55k views

Bash script not executing from crontab [duplicate]

I have the following bash script: #!/bin/bash mysqldump -u ******** -p******** --all-databases | gzip > /home/srvlinux01/MySQLBackups/database_$(date +\%Y-\%m-\%d).sql.gz which is located in ...
9
votes
2answers
400 views

Why does the sequence matter in the execution of these bash commands?

There seems to be some inconsistency that I am not able to understand regarding the bash shell. If I execute: ls;date;time the results of the three queries are shown in sequence. However, on ...
4
votes
2answers
2k views

How do I gvfs-mount without opening a file manager window?

I like to have my devices mounted in Nautilus/Nemo by default when I log in, so I can have symlinks to certain directories. And I don't mean a custom mount or a mount with 10 lines of cryptSetup and ...
1
vote
1answer
571 views

Configure Fail2Ban with bash script

I'm trying to configure the /etc/fail2ban/jail.local config with an bash script. I was thinking to use sed and regular expression to change the sections I need. sed -i "s/^bantime = 600/bantime = ...
0
votes
1answer
275 views

Just installed Ubuntu on my Nexus 10… how do I get to a bash terminal?

I just installed the Touch preview on my Nexus 10. It is not at all what I expected. I thought it would be just like my desktop; I'm not at all interested in the "experience"... all I want is a bash ...
5
votes
1answer
4k views

How to evaluate an arithmetic expression in an “if” statement?

This is my script: #!/bin/bash num=1 while [ $num -lt 100 ] do if [ $num % 3 -eq "0" ] then echo "fizz" elif [ $num % 5 -eq "0" ] then echo "buzz" elif [ $num % 3 -eq "0" ] && [ ...
2
votes
1answer
256 views

Delete lines starting with pattern from a file

I tried several commands: tr, sed but to no avail. Here's the file: > ... > ... > setEPS() > postscript('images/boxplot_default.eps') > ... > ... I want to delete those two ...
0
votes
1answer
102 views

Moving bytes from one files to another

I have an empty file (only zeroes are in it) of size 9,0KB and I need to write another file (with size 1,1KB) to it, but the first file must not lose it's. So if the whole file is 00000000000000... ...
11
votes
1answer
7k views

how to set icons and theme from terminal?

Is there a way to set active icon theme and GTK theme from a terminal? I would like to write a script that installs and sets everything up the way i like it on a fresh install.
4
votes
2answers
309 views

Is 1.abc!``!+123 a valid file name?

Is this a valid file name 1.abc!``!+123 in Ubuntu? I issued the command rm 1.abc!``!+123 and got error message -bash: !``!+123: event not find Why? How to I delete the file?
3
votes
2answers
6k views

Run a screen session on boot from rc.local

I am trying to run a detached screen under a specific user in rc.local on boot. The code below is what I have so far, but it is not working for me. The su part seems to be giving me an error. su - ...
1
vote
0answers
31 views

Bash Script to set “system wide” proxy settings [duplicate]

I am wondering if there is a command (or series of commands) that would do the same thing as network-network proxy-apply system wide. I believe I can export a variable, but I think that that button ...
10
votes
3answers
15k views

How to save terminal history manually?

It's my understanding that the history file is updated when the terminal exits. But sometimes my computer crashes out, and the terminal doesn't exit cleanly, and then I lose those commands from my ...
3
votes
1answer
182 views

Need to run a .bin file, but same error keeps coming up

I have a .bin file that needs to run. I'm trying to start it through the Terminal, and I keep getting an error that says: LSB 3.0 or higher not found I can't get to than internet at my school ...
2
votes
2answers
1k views

how to find exact file without listing folders

my current folder is the top of the folder tree structure somewhere inside I have an *.rpm file. how do I find that *.rpm file in a way that'll list only its full path when found and not list every ...
4
votes
2answers
11k views

Create zip of folder with same name

I want to create zip of a folder from command-line. I can do something like zip -r folder.zip folder. I want to give the zipped folder same name as the original folder. I can simulate this by writing ...
2
votes
2answers
820 views

create backup from directory

I would like to create backup from directory using cron. I wrote following command: cd path && sudo zip -r "backup-$(date +"%Y-%m-%d").zip" git/ && sudo mv "backup-$(date +"%Y-%m-%d").zip" /backup/ ...
5
votes
1answer
5k views

How can I create zip file with the date in its name?

In the command-line, how can I create a zip file from a directory, whose name would be the current date? I can use zip -r name dir, but how give it the date for a name?
4
votes
2answers
256 views

Creating a terminal command to extract tarballs

This is pure laziness, but I'm looking to create a custom terminal command to extract tarballs - ie "targz" then a filename would extract a tar.gz tarball, and "tarbz2"... Well, guess. I followed the ...
0
votes
1answer
4k views

How do I set CLASSPATH variable for Tomcat in 12.10?

Previously, I have set the JAVA_HOME path using the terminal with the following command: export JAVA_HOME="/usr/lib/jvm/java-7-openjdk-i386" >> ~/.bashrc Now, I want to set the CLASSPATH ...
2
votes
4answers
996 views

“sudo bash” ignoring read-only permission of .bash_history file

This problem is in an up-to-date 12.04, and seems to have started recently. I have my .bash_history file set to read only. Lately I've noticed that despite this the file is being modified ! Here's ...
4
votes
4answers
5k views

segmentation fault when using su or sudo

example of the problem: $ su Segmentation fault $ sudo ls Segmentation fault I tried to compile sqlite3 from source earlier. I don't know what libraries it installed. This may be the reason why ...
36
votes
6answers
29k views

How can I get mv (or the * wildcard) to move hidden files?

I am migrating my home directory from an old system to a new one, and the tarball I made contains everything, including hidden files like .bashrc. However, when I move the contents of the unpacked ...
15
votes
3answers
19k views

How to display notebook model number?

I have a notebook HP Pavilion dm4 running Ubuntu 12.04 and I'm trying to determine the model number (like HP Pavilion dm4-2015dx or HP Pavilion dm4-2033cl, etc). There's no such information on ...
1
vote
1answer
188 views

Is $RUN a built in command to execute?

I have a .sh script that starts a java service of mine (I didn't write this). Can someone explain how this actually executes? start() { .. .. # setup classpath . $ROOT/bin/_cp.sh ...
1
vote
3answers
960 views

how to detect that specified machine is present in local network

how can i detect - using bash if possible - that specific (i.e. name or mac address) machine has appeared in local network? IP addresses are dynamically assigned, so I can't rely on "traditional" ...
2
votes
1answer
682 views

Bash Prompt Changes Colors on ls

My prompt is: PS1="\`if [ \$? = 0 ]; then echo \[\e[33m\]':)'\[\e[0m\]; else echo \[\e[31m\]':('\[\e[0m\]; fi\` \e[0;1m\w\e[1m\n\$ " The problem is when I use ls, the prompt changes colors to the ...