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

learn more… | top users | synonyms (1)

1
vote
2answers
29 views

How to close terminal from a bash script

I'm new on this forum and with Linux. I'm trying to make a simple script what will open a new terminal with a new name, and close the old terminal from where the script was running. The problem i ...
1
vote
3answers
28 views

Bash script not recording

So, here i am, playing with some bash scripts, and there is something that doesn't work: #!/bin/bash script -c \ sudo apt-get update && sudo apt-get upgrade && exit echo "(Not ...
2
votes
2answers
38 views

gnome-terminal starts with “grep: write error: Broken pipe” message

I am running Ubuntu 14.04.3, it's uptodate. I don't know why, for a few days I began to take grep: write error: Broken pipe message on launching gnome-terminal . It seems to be harmless but it bothers ...
1
vote
0answers
13 views

script to concatenate multiple text files found in zip archives nested in multiple folders

I have 30 gig of text files and html files from various sources laying in a nested folder hierarchy. All these folders are in my home directory in a folder named zipFiles. The hierarchy is 20 levels ...
0
votes
0answers
6 views

Files selected using zenity --file-select are not added to “recents” shortcut

I'm using zenity to select input files for a lua script on the command-line. While using the GUI already saves time over the alternative of typing in really long filenames, I was hoping to save even ...
0
votes
0answers
11 views

sh script works manually but not via cron

so I have a cronjob created using this tutorial: http://www.matt-helps.com/automatic-backup-of-mysql-database-to-s3/ It runs when I give the command sudo sh s3BucketBackupScript.sh But I can't get ...
0
votes
0answers
9 views

Drop cache pages and memory (cleaning the cache) as normal user

Some times I need to clean the system cache by doing the steps below: sync su echo 3 > /proc/sys/vm/drop_caches as you can see, I need root privileges for this purpose. Is there any way to do ...
0
votes
0answers
13 views

How do I use the mmv utility to move an arbitrary number of files?

I have a folder with too many files, I want to move some of the files to a subdirectory -- without a script. How can I move, or copy, not all files, but the only the first n number of files? For ...
0
votes
0answers
27 views

Bash - for loop help needed please

So I have the below script and it works as expected (it SSH's to 40 hosts, goes to a specific file looks for a specific word with a date of yesterday, puts a . at the end of the line and then mails ...
0
votes
0answers
16 views

Can not run executable files from a mounted drive [on hold]

I have downloaded eclipse and rubymine and previously placed in home folder. Then I used to open both programs by double clicking on eclipse.sh and rubymine.sh. Now I moved these two folders in a ...
16
votes
5answers
4k views

Why does terminal auto complete sometimes not suggest anything for the `services` command?

Sometimes, when I type a command on the terminal, the terminal's autocomplete does not work, even if my command is not wrong. For example, take look to this: sudo service vsftpd status sudo and ...
0
votes
1answer
33 views

How to change command line prompt name and add path of current directory after name? [duplicate]

Currently my command line prompt looks like this nuve@nuve-Inspiron-5547:~$ but I want to change it Azer's Terminal:"Path of current directory". How can I do this? I need exact code line to add to ...
-4
votes
0answers
42 views

How to put a date as one argument [on hold]

I have a decryption program "ELF" that takes in a string as an argument and an encrypted text with a calendar image, when i try to input the encrypted text NXIS24CuEq@uEq@uEq@u into the program I just ...
0
votes
1answer
16 views

Bash script not working with crontab [on hold]

I own a raspberry pi that runs raspbian jessie. I'm using this raspberry with motioneye as a system surveillance. Motioneye records files to a sd card but i want to delete older files in folder ...
0
votes
0answers
21 views

How to improve bash scripting from 1 long line to a better method? [migrated]

I have a script that open up terminal and open up 5 tabs, execute a certain command, and go to a certain working directory. #!/bin/sh gnome-terminal --tab --title="Zookeeper" --profile Hold -e "sh ...
0
votes
3answers
69 views

Sorting the output of my directory

How can i create a new file called Option1.txt on my desktop. This file should contain the contents of my 'home' directory. And how would i make my output is: Sorted alphabetically by entry ...
2
votes
2answers
18 views

Ubuntu/Linux + VeraCrypt + non-relative encrypted volume paths?

Can track of VeraCrypt volume be defined in absolute terms on Linux? Windows + VeraCrypt + encrypted volume absolute paths On Windows I can mount veracrypt encrypted partitions/disks via batch ...
0
votes
0answers
25 views

How to autorun a ruby script in Ubuntu?

I'm using rvm and running ruby 2.3.0. which ruby returns /home/ubuntu/.rvm/rubies/ruby-2.3.0/bin/ruby The script location is: /home/redline/sinatra-aggregator/server.rb. I've tried all sorts of ...
2
votes
1answer
25 views

./run.sh: line 1: java: command not found

I'm trying to install worksnaps client so I can start working on a project. I'm running Ubuntu 14.04 LTS 32bit system. Installation and Configuration for worksnaps are simple : Download the ...
0
votes
1answer
22 views

Bash prompt after format of drives

I'm almost certain I formatted all my partitions to unallocated space, yet on an occasional reboot back to windows 10, I get thrown to a bash prompt. So I have to reboot and select windows boot ...
0
votes
1answer
33 views

Why is rsync copying directory structure when my find result only shows me files?

I have an annoyingly complicated find command I've cobbled together that I pipe to rsync with the intention of copying files and syncing new versions. I'm trying to write something that is efficient ...
0
votes
0answers
69 views

Color coding the terminal with ANSI R,G,B

My question is where would be an appropriate place to share the below script? r=0 g=0 b=0 while : ; do for ((r=0;r<6;r++)); do color=$((16+36*r+6*g+b)); printf "\033[38;5; ...
51
votes
8answers
54k views

How do I make my terminal display graphical pictures?

This is a quick mockup I copy and pasted together. I imagine this being super cool and useful. Does something like this exist already?
0
votes
2answers
34 views

How do I access my Bash History? [duplicate]

I am fairly new to Linux and I need to find a way to show the contents of my Bash History via the command line, and unfortunately I can't seem to find anything that works, or that I can understand. I ...
59
votes
10answers
390k views

How do I run .sh files?

Whenever I open a .sh file, it opens it in gedit instead of the terminal. I can't find any option similar to Right Click → Open With → Other Application... → Terminal. How do I open this file in the ...
1
vote
1answer
48 views

run startup script which requires a xserver session

I have a python3-script which uses the Gtk-module (imported from gi.repository, for recent-manager functionality), requiring a link to the current xserver session (lightdm service in Ubuntu). Running ...
0
votes
1answer
9 views

Unable to start a cron task as root

I use a program to check raid status. The command is megaclisas-status. Here is the issue : Has user /usr/sbin/megaclisas-status return : This script requires Administrator privs => OK Has root ...
-1
votes
1answer
38 views

What's wrong with tee command?

I am running the following python script piped to tee command #!/usr/bin/python from sys import exit,exc_info from time import sleep try: print "hello" #raise KeyboardInterrupt ...
88
votes
10answers
18k views

How can I tell what date Ubuntu was installed?

is there a command which will output the date that ubuntu (or any distribution) was installed?
19
votes
4answers
38k views

What does /dev/null mean in a shell script?

I've started learning bash scripting by using this guide: http://www.tldp.org/LDP/abs/abs-guide.pdf However I got stuck at the first script: cd /var/log cat /dev/null > messages cat /dev/null ...
0
votes
0answers
50 views

conditional binary operator expected [on hold]

This is on Ubuntu 14.04 I am running a provided script and one of the functions is: function isset { [[ -v "$1" ]] } however I am getting the following error: bash: conditional binary ...
10
votes
2answers
2k views

Differences between “<command> & disown” and “nohup <command> & disown”

This is my understanding about the usage of &, disown and nohup: <command>: runs the process within the Terminal's current bash instance, in the foreground (i.e. the process is listed as a ...
0
votes
1answer
30 views

Can't execute this file [on hold]

I can't execute the skype file. I have the permissions I need. What's the meaning of filename* in the ll output?
22
votes
5answers
21k views

Can't make ZSH the default shell

I am trying to set ZSH as my default shell, however it keeps reverting back to bash. I have tried this code: sudo chsh -s $(which zsh) I've also tried: sudo chsh -s /bin/zsh Also tried these ...
2
votes
2answers
136 views

Why do scripts ran via “sh *.sh” function differently than “./*.sh”? [duplicate]

I'm using Ubuntu 15.10. I have noticed a weird problem. When running a rsync command embedded in a shell script (as root) with --exclude={} options, rsync works and excludes paths as it's supposed ...
0
votes
1answer
17 views

How to make shell script restart Java if any thread crashes? [on hold]

I have a multi threaded Java program. Ideally it should run once and successfully terminate. Unfortunately, sometimes one of the threads crashes, such as by throwing DivisionByZeroException. Since ...
4
votes
1answer
530 views

What are the differences between executing shell scripts using “source file.sh”, “./file.sh”, “sh file.sh”, “. ./file.sh”?

Have a look at the code: #!/bin/bash read -p "Eneter 1 for UID and 2 for LOGNAME" choice if [ $choice -eq 1 ] then read -p "Enter UID: " uid logname=`cat /etc/passwd | grep $uid | ...
-1
votes
3answers
46 views

Extract info from file

Is there an efficient way to parse a file like: 2 41620 . T G 100 PASS ...
3
votes
3answers
316 views

Is there a way to autostart CPULIMIT in order to reduce excessive CPU consumption

tracker-miner-f, tracker-store, tracker-extract and dropbox processes are killing my CPU, they make it run at over 100%, overheating my laptop. I have installed CPULIMIT and it works great ...
1
vote
0answers
15 views

Unable to locate package pnp4nagios

I'm having problems trying to find the pnp4nagios package. I don't know what to do. apt-get install pnp4nagios -y
40
votes
4answers
26k views

Bash history handling with multiple terminals

I use mainly Terminator, and it's usually opened with 3 split terminal windows. I also use Gnome terminal for various reasons. I'm wondering how is bash history handled in this case as I sometimes ...
1
vote
2answers
54 views

Problem with using wildcards when I do CP command in Terminal

I am new and try to learning Terminal Command. Today I faced some problem with cp wildcard command option. I wrote in Terminal this command cp Downloads/[:alnum:] test/ Here, Downloads is the ...
0
votes
0answers
36 views

Spelling mistake in ~/.bashrc

I am a newbie and I wanted actually install MeanJS but then I made the following mistake. I wanted to paste this in the terminal: echo 'export PATH=$HOME/.node/bin:$PATH' >> ~/.bashrc But ...
1
vote
0answers
10 views

Shell script to create multiple accounts? [duplicate]

I'm looking for some help with a school project which needs a shell script to create 10 accounts (5 teaches and 5 students into different groups) along with respected passwords. I'm a true ubuntu noob ...
0
votes
1answer
1k views

Crashplan won't install properly

I have downloaded an application called CrashPlan for backups. It comes with the install.sh script below. I ran it but received the following errors. How do i fix this? install.sh: 31: [: x: ...
0
votes
1answer
32 views

How do I write an output of one command into a file? [duplicate]

Let's say we got a content of the following command in bash, which consists of several rows, and just one column: tacmd listsystems | grep -i $i | awk '{print $1}' This content is a list of offline ...
19
votes
4answers
3k views

Why does 'ls > ls.out' cause 'ls.out' to be included in list of names?

Why does $ ls > ls.out cause 'ls.out' to be included in list of names of files in current directory? Why was this chosen to be? Why not otherwise?
3
votes
1answer
132 views

How do I show the git branch with colours in Bash prompt?

I am using this guide to show the branch name in gnome terminal (Ubuntu 15.10) when working in a git repository. Based on the above I now have the below in my ~/.bashrc file: # uncomment for a ...
0
votes
1answer
15 views

How to check network usage over past X minutes

I have a media PC (that is also a web test server on the LAN) that I want to reboot every so often as long as it is not in use. I have tests in place for the server using kodi, myth etc (its the ...
1
vote
1answer
16 views

Cannot backup using Duplicity via cron

I am trying to run a backup script foo.sh via cron. The code is as follows: #!/bin/bash export PASSPHRASE=password123 duplicity ../learningbash file://../../../media/kingston unset PASSPHRASE Then ...