2
votes
1answer
28 views

Running `cp -r ~/.ipython ~/some/path/.ipython` a second time creates `~/some/path/.ipython/.ipython`. How to prevent that?

I am using a script to copy directories to a specified location. When I run cp -r ~/.ipython ~/some/path/.ipython the .ipython dir is copied as expected to the specified location. But when I run this ...
0
votes
1answer
23 views

sed command working in command line but not in script

I have a script with the follow code: find . -name "*.html" -print0 | while IFS= read -r -d '' n; do sed -i -r 's/<font ...
3
votes
1answer
12 views

Linux History Display Dates

I added date and time to my linux history with this command: export HISTTIMEFORMAT='%F %T ' When I actually go to view my history anything that I didn't actually do today seems to pick a time that ...
1
vote
2answers
47 views

How to save echo result into a variable?

I have this output from a s3cmd ls --list-md5 command. 2013-05-22 12:20 1965154 41eae9b40d23de2f02bf07635870f6d0 ...
3
votes
2answers
70 views

Found a script on my cron.monthly, i am wondering what's it doing?

I am new to bash-programming, sorry if this might be a kind of stupid question. I found a script on my server and i am trying to understand every line: #!/bin/sh # # man-db cron weekly set -e if ! ...
2
votes
1answer
28 views

How to change the resolution of the Bash for a Debian VM?

I'm trying to learn how to use Linux with a Debian 7 VM that has no GUI. The 640x400 window I'm working in feels a little constricting and would like to make it bigger, say 1024x768. How can I do ...
0
votes
1answer
31 views

Locking a GNU-screen session after x minutes of non-use on Linux

I have a couple of services running in a GNU-screen session on top of Bash. Because one of the services contain sensitive data I have to constantly either close the terminal completely or lock the ...
0
votes
1answer
32 views

Merge three files into one in a bash script

I have a series of folders containing three files that I want to concatenate as part of a script. The three files are named file.html1 file.html2 file.html3. I want to concatenate them into file.html ...
0
votes
0answers
32 views

what does “cd //” do in linux? [duplicate]

I'm running Ubuntu 12.04 and in bash, when I type cd // I get to what looks like root. However, the pwd command yields //. I can create files, and everything seems to behave like normal bash, just ...
1
vote
2answers
44 views

Difference between almost the same directory commands

Is there any difference between these (almost the same) directory commands? 1. cd 2. cd ~ 3. cd ~/ I tried it in my shell, and they all lead to the home directory. Is there any possible scenario ...
0
votes
1answer
30 views

How do you remove nested empty directories using a Bash script on Linux?

I want to be able to run a script that will remove all my empty directories. The problem is some of them are nested, i.e. directories that only have empty directories in them, so the script needs to ...
0
votes
2answers
45 views

Replacing a dot with an underscore in a file using sed

I was trying to edit the output of a file using sed. The contents of file are cat /tmp/Group_RM t.p@k.p t.m@k.k I was trying to get the output as: cat /tmp/Group_RM t_p@k_p t_m@k_k I tried the ...
4
votes
1answer
78 views

How to execute bash script without password?

I need to execute the script after system boot. For example: (sleep 5 && (sudo dhcpcd wlp4s0)) What I need: Executing the script. What I have: [sudo] password for eugene: I has been edited ...
59
votes
6answers
2k views

How do perform commands in another folder, without repeating the folder path?

I was wondering if there's any clever way to do copy and move operations, or if there's a command to duplicate a file, without having to do a cd, then mv after, at the same folder. For example, I ...
1
vote
1answer
35 views

How do I install 'z' file directory jumper on linux?

I'm attempting to install this and running into issues. I am supposed to add a line to the ".bashrc" file? Where in the file? the bottom? the top? somewhere in the if statement? do I make it an alias? ...
0
votes
0answers
16 views

paravirtualization using xen in debian wheezy

i have been trying to run av virtual machine using xen but in the end i always get the error chroot: failed to run command `/sbin/shadowconfig': Exec format error hook 05-shadowconfig-on: done. ...
0
votes
0answers
25 views

udev rule not working on Debian [closed]

I have created a udev rule which is supposed to mount a USB device, backup some data and clean up everything. I am actually working on a Debian server. Here is the information about my USB device ...
2
votes
3answers
77 views

Is it possible to put foreground process into background without suspending (control +z)?

I am running an application which receives TCP and UDP packets and therefore cannot be suspended. I intially ran 3 processes of the same application, with different arguments, in background mode using ...
0
votes
1answer
35 views

Prevent users from being able to pipe output to another users terminal?

So currently on this server if two people are logged into the same server, you can do something like: -bash-4.1$ cat /dev/urandom | write username It will print a bunch of junk to their terminal. I ...
0
votes
1answer
51 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 ...
0
votes
0answers
41 views

Why does my mv command require an absolute pathname? [closed]

Moving a file from my current directory with mv bar.txt ../../foo/current mv: cannot move `bar.txt' to `../../foo/current': No such file or directory fails, but using the full path as in mv ...
0
votes
1answer
29 views

Use a modern locale, but retain asciibetical sorting?

I bought a new laptop (an Ideapad Yoga), and put Linux Mint on it. Everything seems to be working well, but Mint's default LOCALE settings for my language choice (en-CA... not sure why CA when I'm in ...
3
votes
2answers
36 views

Append line break to command output

I have a single-line command that does a curl request to check server status and then output the result to a log file. But the problem is the returned result has no line break and so the log file ...
1
vote
3answers
83 views

Rename recursively files, while keeping the extension

I have a bunch of directories that each hold one *.txt file in it (and other non *.txt files). I'd like to rename those files recursively from the command line, basically *.txt to info.txt. So all ...
1
vote
2answers
41 views

Unix moving/removing files from subdirectories

if there are several subdirectories in the current working directory, i would like to move only specific filetypes or possibly all the contents of those directories, to the working directory. and ...
1
vote
1answer
36 views

How to enable autocomplete for personal script?

I added my script to /usr/bin, and it runs as expected if I type the full command name. How do I get the terminal to autocomplete the command name?
0
votes
2answers
59 views

How to extract IP address from Amazon hostname?

I really don't know why, but Amazon Web Services provided me with some weird hostnames for my machines. Now I need to list all them with knife to use in a bash script. I'm saying that the IPs are ...
1
vote
5answers
100 views

how to copy entire linux root filesystem to new hard drive on with ssh and tar

I know I've found this information before, but can't remember the right google query. I need to transfer an entire linux root filesystem off of a failing hard drive onto another computer with an ...
0
votes
1answer
19 views

Linux Command to display only mingetty's info

I am looking for a command that will give only mingetty's information. How can you construct the command to find only mingetty data and find the PPID in Linux?
1
vote
3answers
87 views

How to rename multiple files in bash (not by pattern, but prompting for each new name)?

I want to rename all files in a directory. The new names don't follow any pattern, so I can't use rename. Is there any efficient way to do this, so I won't have to use mv foo.txt bar.txt for every ...
0
votes
0answers
15 views

EMACS - SIGINT under Windows

Ctrl-c Ctrl-c is used in Emacs shells to kill the running process. After an upgrade to Windows 7, this has stopped working for me. i.e. it doesn't kill the running process. Instead it just ...
0
votes
0answers
31 views

Shell doesn't appear when connecting to RasPi via SSH

I have a raspberry pi with Arch Linux ARM installed. I would like to run commands via my laptop. I configured SSH correctly and I can log in, but I can't do anything. There is no shell. ssh user@host ...
0
votes
2answers
44 views

How do I remotely execute scripts on multiple servers, mix output

Hi I'm looking for a piece of software or some sort of technique that would enable me to do following in one terminal window: Take as input a list of ssh-enabled machines with login, password and ...
2
votes
1answer
29 views

How do I disable my internet using curl or wget to hit my router in a script?

I want to be able to run some kind of shell script/curl commands to toggle my TV services by accessing a form on my router page using curl or wget. I have been able to get past authentication using ...
1
vote
3answers
23 views

print specific line and then some more

I am trying to search a file for a pattern and if the it is found I want to see the line and 10 more lines of the result. so far I have grep -n pattern file | cut -d: f1 now not sure how to use ...
0
votes
2answers
41 views

bash - execute cmd2 each time cmd1 stdout yields specific string

I'm trying to run WID=`xdotool search "Inbox" | head -1` xdotool windowactivate $WID xdotool key Up each time stdout of $ CAMEL_DEBUG=all evolution yields "starting idle". I've come up with ...
2
votes
1answer
42 views

Edit Current Command in Zsh Vi Mode

So I know that you can set vi mode in bash with set -o vi I also know that you can set vi mode in zsh with bindkey -v The vi mode in bash has a great feature that allows you to edit the command ...
2
votes
1answer
61 views

How can I rename all files setting 1.jpg, 2.jpg, etc?

It's been a long time that I don't do any shell scripting. I'm using Bash on a Ubuntu I've a folder with many jpg pictures with some random name generated by the camera. I want to rename all ...
2
votes
2answers
79 views

Why I can access the dir // in Linux?

I found this dir in my ubuntu server momo@myubuntuserver:/$ cd / momo@myubuntuserver:/$ pwd / momo@myubuntuserver:/$ cd // momo@myubuntuserver://$ pwd // momo@myubuntuserver://$ cd /// ...
0
votes
1answer
25 views

Executable not found although in PATH

My $PATH is set to a lot of directories including ~/bin and ~/target/bin I want to execute script.sh which is in ~/target/bin but I get the error bash: ~/bin/script.sh: No such file or directory ...
0
votes
2answers
46 views

.bash_profile wont run on login

I am trying to set up my computer so that the escape key performs the caps lock function and caps lock performs the escape key function. I have a small script to swap my escape and caps lock using ...
0
votes
1answer
18 views

Do all the scripts that are run in “rc.local” display results on the terminal or do they just run in the background?

Do all the scripts that are run in rc.local display results on the terminal or do they just run in the background? What if I want the scripts to run before the startup and wait for the user input to ...
0
votes
1answer
18 views

Write output to $TMPDIR/$variable : file does not exist (should be created)

I have the following .sh script in which I am trying to do all major writing in $TMPDIR. However, when it gets to line 86, it returns the following error: ...
2
votes
1answer
44 views

How do execute a bash alias in a new screen window?

In my .screenrc, I have several lines similar to the following: screen -t qf1 bash So for that window, I am currently executing bash. Instead, I would like to execute the following alias "qf" which ...
1
vote
2answers
175 views

telnet fails to connect: Connection closed by foreign host

I try to connect to localhost with telnet: % telnet localhost 6311 This connection succeed, but when I connect by external IP of my computer, connection fails: % telnet x.x.x.x 6311 Trying ...
0
votes
2answers
36 views

Sending special bash characters to a custom function

I read this great article on customizing the bash prompt: http://blog.superuser.com/2011/09/21/customizing-your-bash-command-prompt/ I also read about using 256 colors in bash: ...
8
votes
6answers
279 views

In Bash (Mac/Linux terminal shell), can the up and down arrow keys be made to function as they do in text editors?

In text editors, if I press the up and down arrow keys, it moves the cursor between lines of text. In Bash, if I’m typing a long command that spans multiple lines and I press the up and down arrow ...
0
votes
2answers
88 views

What is the difference in various commands for compressing files in linux?

What are the commands for compressing files in linux and what are the difference between them? (for example: tar, gzip, rar). I'm working on Linux Mint 11 and doing a script for compressing files. I ...
0
votes
2answers
38 views

Find recursively a directory and remove it

I have a directory db-cache-db and there are a bunch of them under /home/{USER}/public_html. I know there is a way to write a script to that but I am not sure where or how to start. I tried the ...
6
votes
4answers
148 views

How to selectively navigate through Bash command history on a Linux terminal [duplicate]

Everyone knows (or should know!) that on a terminal the up and down arrow keys are used to navigate through the history of used commands. When you use the terminal on a daily basis, your command ...

1 2 3 4 5 20