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

learn more… | top users | synonyms (1)

0
votes
0answers
11 views

How can I measure the performance of different shells?

Is there a good command pipeline to test the shell rather than the program the shell starts if I want to benchmark differences between for example bash and ksh and also test for compatibility between ...
0
votes
0answers
16 views

Variable is taking value as a file instead of text (String)

I'm trying to make a bash script in which I manipulate a download link with user input dates and such to then download the file. When I run it, it throws an error Final.sh: Line 16: ...
3
votes
5answers
5k views

Removing specific part of filename (what's after the second dash) for all files in a folder

I use the command line utility youtube-dl to download videos from YouTube and make mp3s from them with avconv. I'm doing this under Ubuntu 14.04 and very happy with it. The utility downloads the ...
0
votes
3answers
38 views

How can I run a shell script from bashrc file?

What I basically want to achieve is to type in a custom command in the terminal and a specific shell script should run each time. I could achieve the above requirement with folders,by modifying the ...
7
votes
2answers
389 views

How to change colours in bash prompt

I have followed the instructions here and in the howto link that is provided there. However nowhere does it appear to say how I can change the colours of the different parts, because currently I set ...
8
votes
2answers
316 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 ...
1
vote
0answers
5 views

Using binfmt-misc in conjunction with xattrs

I currently use a piece of sandboxing software on my 14.04 machine that isolates Linux binaries from one another (Using a special type of namespace isolation different than AppArmor) Currently, the ...
0
votes
0answers
52 views

Bash script not working with shortcuts

My bash script is working flawless when i call from terminal. However, when i create shortcut to it acts weird. #!/bin/bash url="" function uploadImage { url="$(curl -s -F "file=@$1" ...
1
vote
0answers
39 views

Non-printing characters showing up in terminal prompt

Without color my prompt looks like this: [0] [dimo414@dimo414:/tmp] $ echo $PS1 | sed 's/\x1b/\\e/g' \n[0] [dimo414@dimo414:/tmp]\n\$ I add some color and \[...\] delimit it: [0] ...
3
votes
2answers
27 views

How to read symbol separated strings from a variable, convert to numbers, and perform arithmetic?

In a bash script, I wish to pass in a string which is contained in a variable, and contains up to 3 substrings separated by the '+' symbol. Each substring will have a specific numeric value, sort of ...
2
votes
1answer
35 views

Shell script password with special chars

I've build a shell mysql backup script which works very well. It only has problems with passwords with special chars like this: xgT{uic[Is?uJ+. Here is the important part of the script: #!/bin/sh ...
0
votes
1answer
16 views

Grub C Code in “set” output?

i made an interesting discovery. When i run set as root the output displays some c code... it seems like some grub boot-loader code.. followed by some unreadable parts. That seems a bit ... wired to ...
25
votes
2answers
8k views

How does this [t]ricky bracket expression in grep work?

I saw this one-liner recently: $ ps -ef | grep [f]irefox thorsen 16730 1 1 Jun19 ? 00:27:27 /usr/lib/firefox/firefox ... So it seems to return the list of processes with "firefox" ...
2
votes
1answer
34 views

Bash prepends the symbol '@' to $PS1. How do I get rid of it?

I'm running Ubuntu 16.04 and bash keeps putting '@' in front of my prompt, regardless of the value set in ~/.bashrc. I've tried setting different values both in the ~/.bashrc file and from within the ...
1
vote
1answer
25 views

Add a delay to a keyboard shortcut

To put my screens on standby, I've defined a keyboard shortcut: xset dpms force standby This causes the screens to go into standby mode immediately. However, I'd like the computer to wait for 2 ...
1
vote
1answer
19 views

How to set up bash autocompletion to deal with file names like “./foo=bar/x=y.txt”?

When I start typing a file name that contains an equal sign, autocompletion with [tab] shows a strange behaviour: ls ./foo[tab] # autocompletion to "./foo\=bar" <- ok ls ./foo=[tab] # ...
2
votes
2answers
19 views

mv a folder and now the folder seems gone

I typed the following: mv /var/www/folder/ ../../ Now I can't find that folder or anything that was inside of it. What am I missing? /var looks like this: root@,my-server:/var# ls -la total 52 ...
3
votes
2answers
119 views

Can VeraCrypt use persistent mount points on Linux?

Can VeraCrypt use persistent mount points on Linux? Windows + VeraCrypt + encrypted volume absolute paths On Windows I can mount veracrypt encrypted partitions/disks via batch script which employs ...
3
votes
1answer
456 views

Where is the Ubuntu file system root directory in Windows NT subsystem and vice versa?

I have installed Ubuntu subsystem on Windows 10 (after enabling feature in settings), but where is the Ubuntu file system root directory located in the drive?
1
vote
1answer
23 views

How to check computer's timezone through Terminal? [duplicate]

I am writing a bash script which at some point needs to determine a user's timezone, so how exactly can I check the timezone in Terminal? I would like to be able to get output in terms of GMT and UTC. ...
2
votes
3answers
278 views

Cyclic script execution

How to make the cyclic execution of the script? At the end of the script i need to run it again. Cron is not suitable, because i need to run the script immediately after the previous
0
votes
1answer
31 views

-gt: unary operator expected shell script

Getting this error after the upgrade packages in ubuntu. #!/bin/bash used=$(df -H | grep 'rootfs' | cut -d "G" -f 4 | cut -d "%" -f 1) limit=90 if [ $used -gt $limit ]; then Or [ "$used" -gt ...
0
votes
2answers
10k views

how to concatenate two strings in shell script in 3.13.0-34-generic kernel

I want to concatenate two strings for the shell file im getting error when i have created the shell file in following manner could you please suggest how to get it set export ...
1
vote
0answers
25 views

Hot Corners Musical Sequence Command Script

I am writing a script which uses hot corners to play specific musical notes when hovering in corners, and depending on the musical sequence to execute a specific command. The script is called with ...
3
votes
2answers
309 views

Command line IF not working as expected

I'm relatively new to the terminal programming. I'm trying to run an IF condition within a FOR loop. (The command is to be run by a cronjob) for i in {1..5}; do echo $i; if [ $i>3 ]; then echo $i; ...
0
votes
1answer
66 views

I can't switch “switch to Downloads directory” using bash (I'm new to this)

I'm new to programming and trying to download Swift on Ubuntu on Windows 10 Insider Preview. I'm now running bash on Ubuntu, I'm trying to get to the Downloads directory. I tried cd ~/Downloads and I ...
0
votes
1answer
21 views

Is there any advantage to Rsync moving files on the same machine?

I was reading how to install Magento on Digital Ocean Ubuntu 14.04 VPS. All files are on the server. the author says: We will use rsync to transfer our Magento files there, since rsync will ...
0
votes
1answer
22 views

Bash script syntax

I want to create a .sh script which will execute a python file called match_scraper.py, update a psql db as shown, call a scrapy spider to execute. When I create the .sh script how do I call ...
0
votes
1answer
21 views

repair ~./profile file

I just messed up with ~/.profile, tried to add something to PATH, but looks like there was a syntax error in my code and now the login screen functionality won't work and I can use ctrl+shift+f1 tty ...
2
votes
1answer
45 views

Auto chmod and launch?

Is there a way to have all files chmoded and then launched automatically? Say when I have my pc off, I insert a usb stick with a game on it, a lot of random files need to be chmoded and then I would ...
1
vote
1answer
27 views

What is POSIX-compatible mode in Linux?

The book says : When in POSIX-compatible mode, bash will emulate sh. What does this mean? What is meant by emulation in simple layman terms?
0
votes
0answers
59 views
+100

Apache startup script keeps lock file open

I am writing a bash script for a backup task. Among other things (file system freeze, database lock, snapshots,...) it involves shutting down Apache and restarting it after the Backup. Since that ...
1
vote
1answer
39 views

Bash script cannot run with keyboard shortcut

I have this script in my /home/username/ And I can run it via terminal with the following code ./script.sh or sh script.sh it works (it has executable permissions) but I cannot assign it to a ...
-1
votes
1answer
22 views

start screen programm with crontab @reboot

I try to start a start.sh at reboot with crontab. But nothing happens afer a reboot, and the log is without an error. Does someone know what i've done wrong? For testing i gave the start.sh and ...
0
votes
2answers
17 views

run two ongoing processes on startup with one that needs initialization time

I'd like to record start recording utility consumption right at startup but I can't find the right combo of operators, pipes, and sleep commands to enter into crontab -e . I think my smartest attempt ...
5
votes
2answers
76 views

Serialise shell commands

I'm looking for a way to "stack" commands from the terminal prompt so that only one at the time is executed: First enter a command, press enter, execution starts, back to shell (like &) I can ...
1
vote
2answers
33 views

Saving work automatically when battery is low

I am a writer and of course I sometimes lose my work if the battery goes dead. I am looking for suggestions for ways to save when the battery gets to 5% or 1%. Maybe a bash command written to save ...
3
votes
3answers
201 views

How to rename all files in folders with pattern

I have a bunch of files like: bla.super.lol.S01E03.omg.bbq.mp4 bla.super.lol.S01E04.omg.bbq.mp4 bla.super.lol.s03e12.omg.bbq.mp4 I need to rename them all like: s01e03.mp4 s01e04.mp4 s03e12.mp4 ...
0
votes
1answer
849 views

How to resize a crypt-luks partition that takes all hard drive?

I want to shrink the partition to be able to install a windows OS, but i installed ubuntu 15.04 with encryption of the logical volume, gparted doesn't support crypt-luks so what do i do?
0
votes
0answers
25 views

Link broken but when “ls” is used on link in terminal the content is displayed

I noticed an interesting fact today. I have a link on my Desktop pointing to windows partition (dual boot Ubuntu 14.04 & Win8.1). Because this partition is not automatically mounted the link is ...
0
votes
2answers
31 views

Can we install a package through a shell script?

I'm trying to write a shell script so that when I reinstall my Ubuntu again. I could just run script and retain all the packages. And I'm planning to pass password in form of argument. My question ...
0
votes
2answers
346 views

Shell script options with parsing arguments

I have the shell script CONTROLLER_IP="" if [ "$#" -eq 1 ] then CONTROLLER_IP=$1 else echo "Usage : create_endpoint.sh --controller-ip <Controller IP>" exit 1 fi but its executing ...
0
votes
1answer
40 views

What command is the most effective for listing processes? [closed]

I've seen lots of developers use ps -ef to list processes and kill them (such as in ENCOM, devs of OS-12). However, there is also htop. A friend told me that it is only a wrapper around ps and ...
1
vote
2answers
39 views

Execute a command stored into a $variable

I made a script where I wrote: COMMAND="/usr/bin/exiftool $PATH_NAME" .... code .... $COMMAND The variable $PATH_NAME is assigned dynamically inside a while loop. The command works fine until it ...
25
votes
7answers
80k views

Not able to execute a .sh file: /bin/bash^M: bad interpreter

I wanted to execute a shell script: -rwxr-x--x 1 root root 17234 Jun 6 18:31 create_mgw_3shelf_6xIPNI1P.sh I tried to do a standard procedure, but I am got this error: ...
-5
votes
0answers
37 views

can someone explain this bin.sh shell script for me? [closed]

Can someone please explain this shell script that was detected from my honeypot? #!/bin/bash busybox rm -rf /tmp/* busybox rm -rf /usr/bin/strings busybox rm -rf /usr/bin/ps busybox wget ...
8
votes
3answers
7k views

Why pssh command is not working?

I have pssh package installed in my Ubuntu 11.10 x64 system. And I can run the program via calling parallel-ssh However, pssh gives me $ pssh No command 'pssh' found, did you mean: Command 'bssh' ...
1
vote
1answer
29 views

rsync can't exclude directories

I run this cmd to backup my folders: $ rsync -av --exclude {/mnt/dati/Film/, /mnt/dati/Scout/} --delete /mnt/dati/ /media/cirelli/HD1TB/backup/dati sending incremental file list And rsync answer ...
1
vote
1answer
27 views

Gnu date input formats

I am trying to get my head around the date input formats used in date -d "something" Specifically I am trying to understand the use of the "Day of week items". The manual page for date refers you ...
0
votes
2answers
45 views

New Terminal bash file error

Upon opening a new terminal in Ubuntu, I get this error. I tried opening the bashrc file but It seems to be empty. bash: /home/rma/prac/devel/setup.bash: No such file or directory bash: ...