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

learn more… | top users | synonyms (1)

2
votes
1answer
30 views

Bash script checking if specific printer is online

Objective: Create a bash script that checks if a certain printer is connected and online (connected: true/false) How can I do this in the terminal (or via python)? I have tried "lpstat -p -d" but ...
0
votes
0answers
10 views

gnome-terminal / mate-terminal don't save history on ~./bash_history

Two days ago I was using my computer as usual, when I noticed that the commands I used in mate-terminal were not saved in the history. I tried installing gnome-terminal. But it does the same. I was ...
0
votes
2answers
27 views

pipe whole script to file and terminal

i want a 1liner to pipe to file AND terminal at the same time(write 1 command, then all other commands are shown like normal in terminal, but output, preferably but not required : command name, to be ...
1
vote
1answer
14 views

What is the difference between 'exec ssh localhost' and 'ssh localhost'?

I read man exec output, but did not understand the difference between these two commands: exec ssh localhost and ssh localhost. I tested both commands and did not found any difference. Is there any ...
1
vote
1answer
15 views

phone book script

Good day I am a newbie in Linux scripting, and I am now exploring LINUX then suddenly I was motivated to create a program and I want to create a phone book program I am now done creating the menu that ...
2
votes
2answers
324 views

Uncompress file from URL to hard disk?

How to uncompress directly from terminal if I have the URL of the file? For example : unzip www.test.com/test.zip destination-folder-on-my-pc
0
votes
0answers
25 views

cannot execute binary file: Exec format error [duplicate]

i´m new in ubuntu and i´m trying to install a program created by one of my professors, but when i try to start it, the terminal send me the message: bash: ../bin/cidre.exe: cannot execute binary ...
2
votes
1answer
152 views

Can I set up a cron job on Ubuntu Phone

I've been looking around, and can't find if Ubuntu Touch can run cron. So my question is: Can it? Also does it have a standard set of bash utils installed?
1
vote
2answers
589 views

Bash “unexpected end of file” on line 11, there is no line 11

I'm trying a new conky theme on my Lubuntu system, and for running it I need to start a bash script: #!/bin/bash #sleep 18&& conky -c /home/mathijs/conky/conky1&& sleep 1&& ...
3
votes
1answer
40 views

What does '*' mean in the output to 'history' command?

I was seeing my history when I found a line with a * whereas, in general, the history has an output without any * I noticed this for the first time. When does this * appear and why? EDIT: ...
2
votes
1answer
59 views

Store grive command output to variable in bash script

I am trying to create a script that syncs my computer with google drive using the grive tool. I would like to store the output of the grive command to a bash variable, but I can't seem to get it to ...
77
votes
7answers
109k views

How to get bash or ssh into a running container in background mode?

I want to ssh or bash into a running docker container. Please, see example: $ sudo docker run -d webserver webserver is clean image from ubuntu:14.04 $ sudo docker ps CONTAINER ID IMAGE ...
1
vote
2answers
21 views

Is it possible to specify a different zshrc file on login over ssh?

I spend all day ssh'ing into servers for work and the remote user is one that is shared by myself and several colleagues so I can't just blindly customise the shell as not everyone will want my tweaks ...
0
votes
1answer
20 views

Running lubuntu 14.04, easiest, fool proof way, to create a desktop shortcut and to execute sh file from desktop?

It sounds easy, but hell, it is not. I want a desktop icon that executes: /home/<username>/dev/intellij/bin/idea.sh if I create a sh file on desktop, it opens with leafpad. If I create ln ...
0
votes
1answer
40 views

I accidently ran 'sudo chmod -R 775 /' and it completely broke my OS/Shell [duplicate]

So I accidentally did sudo chmod -R 775 / when I meant to do sudo chmod -R 775 ./. I quickly realized and hit Ctrl^C, but not in time to save everything. I realize this is a really stupid mistake and ...
1
vote
1answer
26 views

Bash script exiting when repeated in double click execution

This is my code #!/bin/bash function boo { function goo { echo "Please enter name" read name; echo "Hello $name" } function xoo { echo "Please ...
2
votes
1answer
52 views

Who is telling me “You have mail”

On a server running Ubuntu 14.04 I see You have new mail in the motd every time I log in via SSH. Q: Who is telling me this? Mail does not find anything, and I do not expect any mails on this ...
3
votes
1answer
34 views

How can I transfer my bash history to a new system?

My bash history is my memory, it contains commands that I don't want to loose when I update to a newer version of Ubuntu or change my computer. Is it possible to transfer the commands database to a ...
1
vote
3answers
2k views

Command to run GUI Frontend for apt-get update

I want know, if there is any command to run apt-get update in GUI like in the picture following: All i want to do is to write a script which will update the software sources through this gui ...
4
votes
2answers
122 views

Terminal autocomplete functionality can only match from the beginning?

For example, if I type in "apt-"and press tab,I can find "apt-get" below.But if I type in "get", "apt-get" cannot appear. How can I do to match not only from the beginning?
0
votes
1answer
33 views

Running Bash script at login

This question has been asked numerous times but for some reason, none of the solutions proposed worked for me. I just want to run a simple script after the user has logged in. Here are my attempts: ...
26
votes
6answers
20k 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 ...
1
vote
2answers
18 views

How to navigate to directory which file system object has just been moved to?

I often find when using mv somefile somepath I often need to go to the location which the file had just been moved to. basically mv somefile somepath && cd somepath is there a way to ...
0
votes
1answer
232 views

How do I use a shell command as a launcher shortcut? [duplicate]

The following command from terminal works perfectly: sh /home/flux/Downloads/TeamSpeak3-Client-linux_amd64/ts3client_runscript.sh How would I go about adding this as a shortcut, so I can open ...
1
vote
2answers
36 views

How can I get a list with the packages selected by apt-get autoremove?

Is there any command that prints only the name of the packages that apt-get autoremove selects? I'm creating a script that updates the kernel, removes the old kernel and the unnecessary packages ...
2
votes
0answers
28 views

preseed file and installation script

I am using a preseed file to auto install ubuntu 12.04. I create a normal user account (able to use sudo), I skip the creation of a root account. At the end of the file I have put this (seen it from ...
5
votes
1answer
55 views

Help with “Exec=…” line for .desktop launcher - command works only in terminal [on hold]

I want to add another context menu option to my Thunderbird launcher in Unity. However, it does not work. The additional action appears in the launcher's context menu, and when I click it the cursor ...
5
votes
2answers
43 views

How to get [TAB] to work with arguments of aliases to autocomplete as can be done with the actual command

I have many aliases that I created in my .bash_aliases file, and they are very useful, so if I want all info on a package I do something like: allinfo software-center And that does the equivalent ...
1
vote
2answers
22 views

Accidentally changed shell in gnome-terminal, no longer opens

I wanted to make screenfetch start at terminal startup. But I realized that I changed the shell from bash to screenfetch and of course gnome terminal doesn't startup. I have installed MATE terminal ...
0
votes
1answer
38 views

How to run a web url script in a terminal

I am attempting to launch a script via my terminal. It runs fine in my browser but not in the terminal. Ive tried... sudo curl https://www.example.com/myscript?info=1 sudo wget -q -O- ...
1
vote
3answers
51 views

bash: /home/rathin/.profile:: No such file or directory while trying to reload it via “source ~/.profile” after editing it through “vi ~/.profile”

After I edited my ~/.profile via vi command, couldn't get out of it successfully. So I closed the terminal and when I tried it again after reopening terminal, it showed duplicate file named ...
0
votes
1answer
18 views

read numbers with e in awk

Hello a file I am working with looks: header // SeqT: {"POS-s":174.683, "time":0.0130084} SeqT: {"POS-s":431.49, "time":0.0221447} ...
1
vote
1answer
195 views

How to create a script to sync notes to files using Geeknote

The problem I want to create a directory with my notes from Evernote in files with the Markdown format. I found out that this can be made using Geeknote, but for each notebook every time. How to ...
2
votes
3answers
83 views

Bash for loop - how can I include blank newlines? (IFS) [on hold]

Please note this is pseudocode, and I am not trying to count lines this way, this question is to figure out how to include completely blank newlines in a for loop. cat file word word Since ...
6
votes
4answers
33k views

How to get the hostname using terminal command-line?

I have used arp-scan in terminal to get the ipaddress as well as mac address, is there anyway i can get to know the hostname of the ipaddress that are there in the terminal? for example there are A-pc ...
0
votes
3answers
42 views

Why does asterisk produce unexpected results?

I'm new to bash. From the Finding Files documentation: You want to find every file in ~/mydir and all its subdirectories, recursively, with a file extension of .htm (or .HTM or .Htm...) and delete ...
24
votes
9answers
69k views

How to remove all files and subdirectories in a directory WITHOUT deleting the directory in bash?

Is there a command to remove all files and subdirectories in a directory WITHOUT deleting the directory? For example if I have directory "dontDeleteMe" with subdirectories "1", "2", "3" and each ...
0
votes
1answer
12 views

ROS installation:Environment setup:No such a file or directory

according to wiki tutorial of ROS installation. All of the previous steps are ok for me, but when I try to do the part of environment setup. When I type: echo "source /opt/ros/jade/setup.bash" ...
0
votes
2answers
23 views

history erase shell script not working

I am creating shelll script that is erase history of commands in the terminal. But the script is not erase the history of commands in the terminal. I follow below procedure 1. My script contains ...
1
vote
3answers
865 views

executing certain commands do absolutely nothing

I have installed 3 new packages recently through NPM and none of them are executing. I ran sudo npm install -g ionic and the installation looked like normal. Then I can run which ionic and I get ...
1
vote
2answers
49 views

In Bash or ZSH, is there an opposite to the `clear` command?

Typing clear into a shell creates a bunch of new lines until the output history above is all but hidden. Is there a command or method that does the opposite of clear? That essentially moves your ...
0
votes
1answer
18 views

Run html2text on all files in a directory that do not have an extention

I have a directory filled with many files with no extensions that were put there by a call to wget. I want to use html2text to convert all these files to plain text files. In other words, how to ...
0
votes
2answers
14 views

Wget from webpage in html to many text files

To download all the page one level below superSite.com I do: wget -r -l1 http:/superSite.com But these pages are saved in the .html format. How can I have them be saved in .txt format? (I need to ...
39
votes
12answers
123k views

How can I create a select menu in a shell script?

I'm creating a simple bash script and I want to create a select menu in it, like this: ./script echo "Choose your option:" 1) Option 1 2) Option 2 3) Option 3 4) Quit And according to ...
3
votes
1answer
33 views

Run a script on shutdown and not on reboot [duplicate]

I'm executing a script on Ubuntu 14.04.1 LTS when the server is stopping But I would like to execute it only on shutdown behavior, not whendoing a reboot. I tried to get the value with $1but for ...
0
votes
1answer
23 views

How does terminal autocomplete for arguments works? [duplicate]

I find the auto-completion feature of the terminal real amazing! And sometime I ask myself "where does the terminal get that information" For example a have coded a small C-Script with a few ...
2
votes
5answers
3k views

How to remove special 'M-BM-' character with sed

I have file that was created by copying content from DOCX document with LibreOffice into text file. I have modified file with sed to remove additional spaces and other stuff but then I noticed space ...
8
votes
8answers
14k views

How to compare two files

So basically what I want to do is compare two file by line by column 2. How could I accomplish this? File_1.txt: User1 US User2 US User3 US File_2.txt: User1 US User2 US User3 NG Output_File: ...
1
vote
2answers
207 views

Why is my function not re-evaluated in PS1?

I'm trying to have a part of my prompt set dynamically by a function, so in my .bashrc I have: asdf () { echo -n $(pwd) } PS1="\u@\h:\w $(asdf)\$ " Opening a shell gives me what I expect at ...
4
votes
1answer
25 views

Switiching Java version per session

I have a combination of Java7 and Java8 installed on my 14.04 machine. When I want to switch between them I do a sudo update-alternatives --config java. However, changing it this way changes the ...