1
vote
2answers
33 views

SSH Connection refused wrong port

I want to connect to remote server through Ubuntu shell. I am using ssh root@serverIP in Ubuntu shell but I receive this msg: connect to host xxx.xxx.xx.xx port 22: Connection refused This IP is on ...
0
votes
1answer
53 views

shellinabox - How can I restrict access to certain users only?

I've got a Ubuntu 14.04 machine which I've set up with shellinabox. Now I would like to restrict access to shellinabox to only a certain user account. Nobody else should be able to log in with it. ...
0
votes
1answer
15 views

exiting current terminal in a script

I have made alias for running certain program and i have put it in .bashrc file. I want to close current terminal inside the script. I've tried this but it is not working. alias mp='java -jar ...
0
votes
2answers
119 views

change shell of a user from /bin/false to another

I made a mistake of change the root shell to /bin/false, but when I want to change it back, I always got error sudo chsh -s /bin/bash root [sudo] password: <input current user password> ...
0
votes
0answers
55 views

Ubuntu: `env -i bash --norc`, but include essential variables such as HOME, DISPLAY? (where are these set?)

Is there an easy way to isolate a session of bash so that only essential variables (HOME, USER, DISPLAY, etc.) are preserved? (essential in that many programs fail if HOME, DISPLAY, TERM, SHELL, etc. ...
4
votes
1answer
86 views

Shell history support that doesn't suck?

When I use multiple terminal sessions at once, bash only persists the commands from one of them. Then later when I try to do a reverse command search, the command I want is not going to come up, ...
0
votes
0answers
46 views

Boot to shell instead of initramfs in ubuntu core

I'm working on an Ubuntu Core Implementation for ODROID-XU, what I've done so far it's taking a Xubuntu Implementation, Replaced filesystem and patched to activate Console (Debug UART), The board ...
1
vote
1answer
342 views

In a Shell scripts, check version of installed package, make a decision based on output

Looking to write a cross distro / cross version shell script that makes sure a forced version of PHP is installed Example: Ubuntu 12.04 has 5.3, Ubuntu 13.10 has 5.5, Debian 7 has 5.4 I need this ...
0
votes
3answers
179 views

Shell is interpreting IFS=$'\n' as IFS='n'

I am using a Bash shell on a Ubuntu 12.04 LTS server, and it seems that IFS=$'\n' is being treated as IFS='n'. Script in use: concat=$(echo -n "concat:" && find ...
1
vote
2answers
61 views

How to save linux command?

I am using grep -r [^a-zA-Z0-9]myVariableName[^a-zA-Z0-9] -n JS_files/ as mygrep file grep -r [^a-zA-Z0-9]$1[^a-zA-Z0-9] -n JS_files/ and then sh mygrep myVariableName But then I lose the ...
0
votes
2answers
2k views

Exit sudo in the middle of a shell script

I have a shell script in which most of the commands need to be run under sudo; however, the last few commands need to be run as the current user. Is there a way I can exit sudo and switch to the ...
0
votes
1answer
85 views

Can't remove a directory

I'm trying this: rm -fr /app/foo But getting error message: rm: cannot remove `/app/foo': Is a directory What I'm doing wrong?
1
vote
1answer
352 views

FreeBSD csh style history auto completion in bash

I am looking for a way to make it so that my ubuntu bash shell has the same kind of history completion as you get with csh in FreeBSD. The behavior is that on the command line if i start to type ...
1
vote
1answer
1k views

Created desktop shortcut in Elementary Linux, does not appear in list of applications

After a couple of hours of tinkering I have Oracle SQL Developer installed on ElementaryOS (based off Ubuntu) and created a desktop shortcut Oracle SQL developer.desktop in /usr/share/applicatons ...
1
vote
1answer
103 views

Why is [find] running incredible fast, if run twice?

In the Dash of my Ubuntu/Linux system are two versions of the same program. To find where the corresponding .desktop files are located I used find / -type f -name 'Sublime Text.desktop' 2> ...
0
votes
3answers
867 views

How to schedule/unschedule cron job from shell

I have a ubuntu server where I put my application core. It's a jar that needs to be always listening for requests. I made a script to run it with the correct parameters. The scenario is similar to ...
10
votes
2answers
739 views

How to cut a file to a given size under Linux?

I want to shrink a file's size by brute-force, that is, I don't care about the rest, I just want to cut the file, say by half, and discard the rest. The first thing that comes to mind is Perl's ...
1
vote
0answers
110 views

Shell command to find width of a text rendered with some font

I need to find the width, in pixels, of a string displayed with some font. I know that I can do: dzen2-textwidth \ -adobe-times-medium-r-normal--8-80-75-75-p-44-iso8859-1 \ "A Tale of Two ...
0
votes
2answers
145 views

some environment variables not load under certain circumstances

It is most weird. I have set the environment variable TEST in .bashrc, .bash_profile, .profile, /etc/profile and /etc/profile.d/ - everywhere a sane computer might look for it: TEST=successfull ...
39
votes
2answers
4k views

what is the difference between “command && command” and “command ; command”

I see these two usage on Ubuntu "command && command" and "command ; command", e.g. apt-get update && apt-get upgrade What would differ if I use apt-get update; apt-get upgrade? I ...
2
votes
2answers
754 views

Working with git via crontab

I have the following shell script #!/bin/bash REPODIR=$HOME/work/repository/ cd $REPODIR var=`git fetch --dry-run 2>&1` echo $var > $HOME/error.txt I want to run my script every minute, ...
1
vote
3answers
99 views

Directory /ETC has been moved! — Ubuntu 13.04

I made a bad move by moving my /etc directory to Dropbox in hopes to sync two computer enviroments. After moving the /etc directory any sudo commands responded with "Who is this UID 1000?". Basically ...
1
vote
2answers
4k views

Run a shell script on Ubuntu startup

I have a shell scrip that runs on jvm, it works as I write: sh /opt/bin/myshel.sh I added a shell script to /etc/inti.d with this detail: #! /bin/sh ### BEGIN INIT INFO # Provides: ...
0
votes
1answer
84 views

rm the current directory you are in and issues surrounding it

If I cd to a directory, is there a quick way to delete the directory I am in and move to the top directory? Usually I cd to a directory, ls it and then cd .. then delete the folder. I want to be able ...
2
votes
3answers
402 views

Mail me when someone runs sudo

I have added the below lines to /etc/sudoers.d/my_sudoers Defaults mail_always Defaults mailto="email@domain.com" I get an email every time sudo is run How can i modify this so I only ...
1
vote
2answers
227 views

Delete users who havent logged in for x days

got the simple code below USERS=`cat /etc/passwd` for USER in $USERS do echo "---------- $USER --------------" last -n 4 $USER done I want to ideally remove all users who haven't logged in ...
1
vote
1answer
494 views

Ubuntu kill java program started by bash

I've got a problem with killing my Java Program on Ubuntu. I created the following init script: #!/bin/sh ### BEGIN INIT INFO # Provides: control ... # Required-Start: $remote_fs ...
0
votes
3answers
3k views

Create a bootable pen drive through Linux command line

Can I make a bootable pen drive from a ISO using the Linux command line without installing any extra software? If yes, what are the commands?
3
votes
2answers
128 views

Very Simple Script to Remove Last 5 Lines of a Series of Text Files

For some reason this script outputs three files for each original, rather than one. Must have made some trivial error - I'm new to this! Much obliged if anyone could explain why this happens. ...
1
vote
1answer
2k views

init.d script for OpenOffice / LibreOffice headless does not stop process

I am using Ubuntu and found this init.d script for LibreOffice headless. Problem is that it does not seem to be stopping the process when asked to "stop". Any help greatly appreciated. Two other ...
1
vote
1answer
448 views

Autologout after logging in

I have a Ubuntu 10.04 LTS server. I'm currently logged in as root, because I suddenly cannot log into my account anymore. When I execute su useraccount, nothing happens. The log file auth.log ...
5
votes
8answers
12k views

How to find out the top space-consuming directories or files?

My disk is running out of space: $ df -h Filesystem Size Used Avail Use% Mounted on ... /dev/sda7 803G 715G 48G 95% /home I'd like to go through the whole home directory and find ...
1
vote
1answer
212 views

Pass filename to shell script

On Windows, I can drag and drop a file to a batch file to pass the filename. On Ubuntu 12.10, I can't drag and drop to an .sh file. Opening terminal and running ./sh-file-name.sh file-name.txt ...
1
vote
1answer
350 views

How to save environment variable on my Ubuntu Linux system

I am using Maven to the build process of my Java project. To launch the mvn command in any position within the shell I am using the following command to declare the environment variable in this way: ...
0
votes
3answers
172 views

Ubuntu bash script: the shell is changing without any reason

I'm having a strange behaviour with a shell script on Ubuntu 12.04.1 LTS. My script is scheduled to be launched every hour (in crontab). It uses /bin/bash, but sometimes it switches to /bin/sh ...
1
vote
1answer
120 views

Tail -f with pagination

I am trying to tail file with pagination tail -f foo.txt | more This works fine until file gets lets say 200 lines injected, when this happens nature of tail command is to go to end of file, at that ...
1
vote
1answer
146 views

Get PS1 evaluated value, or shell prompt value

I am trying to find the command that would return me evaluated value of $PS1 variable or just shell prompt with current path. e.g. foo-user@bar-pc:~\bar I would like to avoid using something like, ...
0
votes
0answers
233 views

Xubuntu 12.04: Slow Login

I'm running Xubuntu 12.04, and after I ran the update, my login started slowing down big time. I've dabbled a little bit with the programs in Settings -> Settings Manager -> Session and Startup, and ...
1
vote
3answers
682 views

Running script on multiple ubuntu computers automatically

I have many ubuntu 10.04 computers. Is there any program that can allow me to select a shell file, and have it automatically log in to each computer of a list of computers (through say ssh), and ...
3
votes
4answers
555 views

When I ssh into a ubuntu machine, what kind of shell am I using

I keep reading about interactive, non-interactive, login, and non-login shells. (This is in the context of which of the .bash* files is read). I don't understand what each type of shell is, so let's ...
7
votes
1answer
331 views

Setting http_proxy for Chromium in shell

In order to set proxy in Chromium browser, one needs to go to Settings → Under the Hood → Change Proxy Settings → Network Proxy. It's too complicated. How do I set http_proxy in shell? I've ...
1
vote
3answers
2k views

windows CLI looking like ubuntu terminal [closed]

How can I make my windows 7 command line interface to look like the terminal in Ubuntu ?
2
votes
1answer
516 views

How to permanently mount ntfs drive in WUBI installation mode?

I have a Windows 7 installed as my primary operating system on my C:\ drive. I have another ntfs partition, D:. Ubuntu is installed using WUBI on C:\Ubuntu, which makes C:\ accessible through ...
1
vote
2answers
226 views

Combined sudo su deploy command doesn't work, does when separate

I have this command: ubuntu@ip-10:~$ sudo su deploy -c 'rvm install 1.9.3' bash: rvm: command not found I also tried: ubuntu@ip-10:~$ sudo su deploy -c 'source /home/deploy/.bashrc && rvm ...
0
votes
1answer
70 views

Segmentation fault when running bib2x

I'm working on an unfamiliar machine and I am trying to get a program called bib2x to work. Unfortunately, when I run the program, I keep getting a segmentation fault. My (limited) experience and ...
2
votes
3answers
4k views

Linux Ubuntu 12.04 high Load without high cpu/ram usage. Which tools and techniques to diagnose/solve this?

I'm having a huge load after install Linux Ubuntu 12.04 My machine now is a Intel G620/4G RAM/ 1T HD, before it was a Amd X2 5000/4G RAM/250G HD Now uptime in idle mode: 12:45:03 up 3 days, ...
0
votes
1answer
35 views

Creating a link to name changing directory

I have an Ubuntu 12.04 installed using wubi + Win7. I'm trying to create a link to "my documents" directory which located in my C drive: C:\Users\Myuser\My Documents\ Since the Ubuntu is installed ...
4
votes
2answers
124 views

Read files inside directory and group them on new sub-directory (creating the subdir and renaming the file)

I've performed a recovery for old deleted files! The process was a complete success and recovered files from years ago. Now the problem is going through all the 400000 files recovered of the type JPG ...
2
votes
2answers
379 views

What happens under the hood when I run a command line program in another programming language?

Some programming languages have system() exec() calls where I can run commands. What exactly happens when I do that? If I run system("ls") Does it run a bash interpreter on the string? Does it make an ...
1
vote
1answer
93 views

Alternate shell behaving strangely

I set up my default shell on ubuntu to be sudosh2 instead of the default /bin/bash. Now when I ssh into the account, I get some presumably bare-bones shell behavior (only $ prompt, arrow keys result ...