Bash is a free shell for Unix-like operating systems, from the GNU Project

learn more… | top users | synonyms

0
votes
1answer
14 views

Why echo $(crontab -l) outputs current working directory listing and only then the content of crontab file itself?

So if cwd is the /tmp now: crontab -l > #min hour day mon dow command > * * * * * /usr/local/bin/growlnotify -t 'helloTitle' -m 'helloMessage' -n 'myApp' -sw but: echo $(crontab -l) > ...
0
votes
1answer
11 views

Remove file extension in OS X using Terminal

Problem: I have some 200+ files named something in line with "DSC01852.JPG.jpg". I would like to remove the file extension so the result becomes "DSC01852.JPG". Any suggestions? I looked at the mv ...
0
votes
1answer
29 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
28 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
1answer
22 views

How to convert ASCII character to integer in bash?

I'm parsing an ntpq output to pass its contents to our database via console utility. The first element is a one character substring containing status of the remote. It can be "*", "+", "o", "#" etc. ...
1
vote
2answers
32 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 ...
1
vote
0answers
33 views

File shows different size after copying to another directory

I used cp -rP <dir name> <new dir name> to copy the contents of a directory, including permissions etc from one dir to another. The odd thing is, either du is giving me some strange ...
0
votes
1answer
26 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 ...
6
votes
2answers
165 views

Why does redirecting the output of a file to itself produce a blank file?

Why does redirecting the output of a file to itself produce a blank file? Stated in Bash, why do less foo.txt > foo.txt and fold foo.txt > foo.txt produce an empty foo.txt? Since an ...
0
votes
2answers
44 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
64 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 ...
1
vote
1answer
34 views

Pass result of the command to exec

I have a kind of "bash newbie" question: how do I pass the result output of one command to exec. The result of the first command is the name of other command, so exec should be able to execute it.
55
votes
5answers
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 ...
2
votes
2answers
29 views

SSH remote command no reading all environment variables

I have declared some "PATH" variables in the ".bashrc" file of a remote machine. When I login to the remote machine, all these "PATH" variables work fine. But when I do a "ssh user@remote env", the ...
0
votes
0answers
14 views

How do I change my bash prompt to say the user I'm logged in as + my current directory? [duplicate]

What I mean is, right now my bash prompt looks like this: http://puu.sh/2UH1K.png I want it instead to say: {username} @ {current directory} (EG: root@/home/public_html/ ~)
1
vote
1answer
34 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
12 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
8 views

Going back to a stopped job [duplicate]

wim@wim-zenbook:~$ ipython Python 2.7.4 (default, Apr 19 2013, 18:28:01) Type "copyright", "credits" or "license" for more information. IPython 0.13.2 -- An enhanced Interactive Python. ? ...
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 ...
1
vote
2answers
30 views

Is it possible to run software as a different user under OS X Mountain Lion?

I've been trying to run apps as a different user. Attempt 1 sudo -u otheruser open /Applications/TextEdit.app launches the app but it uses the current user, not otheruser. Attempt 2 login username ...
1
vote
1answer
42 views

Where to store bash scripts that all users may execute on Debian?

I have many bash scripts on my server, that all users may use. but it seems the location /usr/local/sbin is not the best place. I don't want to use the home directory of the users, cause ...
0
votes
2answers
26 views

how do I add /usr/local/sbin to the PATH of a user? [duplicate]

if I type echo $PATH I only get /usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games how can I add /usr/local/sbin to the path, so it is already there the next time? (I use debian ...
2
votes
3answers
75 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 ...
0
votes
2answers
27 views

Prepend prefix in tar

I currently do in a shellscript very inefficiently: cp -a $MYPATH /tmp/$VERSION cd /tmp tar cjf archive.tar.bz2 $VERSION I want everything to be contained in the directory called $VERSION - is ...
0
votes
2answers
56 views

Throttle CPU based on Temperature? - Ubuntu

I was running some programs on my Ubuntu machine that use max CPU power for extended periods of time. This causes the computer to overheat. Could someone suggest a good program that will throttle ...
0
votes
1answer
14 views

Modify Several Plist Using a Script

defaults read /New.plist itemName the Output Will Be Some Thing Like "Software" but i want the new Data to be updated for the key as "Software Old Version" the problem is i have to modify several ...
3
votes
2answers
33 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
votes
3answers
81 views

How to paste multiple Bash commands into a shell without losing some?

It's nice to copy-paste a series of Bash commands that you find on a website. But depending on the commands, sometimes you lose a few. Maybe they get swallowed up by programs that read from standard ...
1
vote
3answers
78 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 ...
0
votes
4answers
14 views

short alias for file in bash command

I want short way to access files, which i usually use in bash. For example, see logs. Now i use: less /var/log/user/server.log less /var/log/user/server2.log I want shortcut, to do less server.log ...
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
34 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
56 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
89 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?
3
votes
1answer
49 views

Using grep to remove lines from a file which contain a string from another file

I have a file containing words (one per line) such as Dog Fish Cat Shoes I have a secondary file in CSV format such as 1,shoes,red 2,apple,black 3,fog,blue I would like to use grep with ...
2
votes
2answers
23 views

Place contents of last command line output into clipboard

I want to be able to run a command in my Terminal, and then quickly be able to copy the contents of the output into my clipboard without leaving my keyboard. Is there any way to do this?
1
vote
2answers
49 views

Bash script to extract audio from video

I have written this little script to batch extract audio from video using avconv. It was working fine, but strangely it doesn't work anymore (since I have changed the codec from aac to mp3). The ...
2
votes
1answer
41 views

Sort out where to put my bash commands, alias, and configurations

It seems to me that every Linux distro that I SSH into or use locally (Mostly RHEL/CentOS and Debian/Ubuntu machines) have a different idea about which of .bashrc and .bash_profile to run when I log ...
2
votes
1answer
50 views

How can you reverse the direction of alt-period in Bash?

In Bash, you can press Alt-. to insert the last argument of the previous command. If you press it multiple times, it cycles through the last arguments of all of the commands in your history. However, ...
0
votes
1answer
15 views

launch an automatic action once connected to a specific ssid on OS X

My college requires a local gateway authentication webpage after connecting to their wifi, so I would like to make my macbook pro to automatically run curl with the proper user and password when I ...
1
vote
4answers
101 views

Use “cd -” without any output

How do I run the cd - command without echoing out any output? I tried cd - 2>&1 /dev/null but that prints out the destination directory. The reason for this is that I would like to use it an a ...
0
votes
0answers
20 views

Certain actions in Terminal.app in OS X cause noise in audio/video streaming

If I'm listening to something in Pandora or YouTube, and I'm in Terminal.app in OS X 10.7.5, if I use the up arrow to scroll through bash command history, then that works fine with no noises. But, if ...
0
votes
0answers
13 views

rvm cluttering up my environment vars

I was trying to see a list of my environment variables in Bash (Mac Terminal) by typing set. But when I do, I am overwhelmed by a bunch of functions apparently defined by RVM. Is this supposed to ...
-4
votes
0answers
22 views

Terminal cuts off command output from last? [closed]

I am working on bash script and when my script reach and execute command. I am expecting longer output in terminal but it just shows 20 to 25 lines as output and rest of lines disappears. Please help
1
vote
3answers
77 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 ...

1 2 3 4 5 62