1
vote
4answers
145 views

Shell script: ssh to remote machine, then exit: 'exit' does not work

I have a shell script of the following type: #!/bin/bash ssh mylogin@myremotemachine.com echo "Hi" exit I run it locally to do something on a remote server (represented by 'echo "Hi"'). However, ...
0
votes
1answer
12 views

Surpress execution trace for echo command?

I'm running shell scripts from Jenkins, which kicks off shell scripts with the shebang options #!/bin/sh -ex. According to Bash Shebang for dummies?, -x, "causes the shell to print an execution ...
0
votes
1answer
23 views

'dd' command on Damn Small Linux?

I looked at the package list of DSL, and I don't see 'dd'. For example I would like to restore /dev/sdb from an .img file like so: dd bs=1M if=/home/myname/image.img of=/dev/sdb What command do I ...
0
votes
0answers
15 views

How to batch download wikipedia pages as pdf?

I have a list of wikipedia pages that I'd like to keep updated in pdf format. What would be the easiest way to do this? The ideal workflow for me would be something that I can put into a shell or ...
0
votes
2answers
72 views

Linux zip and exclude directory in Bash script

I am trying to write a bash/shell script to zip up a specific folder and ignore certain sub-dirs in that folder. This is the folder I am trying to zip "sync_test5": My bash script generates an ...
0
votes
2answers
40 views

Renaming files from a list of filenames

I'm still very new to shell scripting so I'm sure this command is all kinds of wrong. I am trying to rename a folder of files to the names in a txt file. The precondition is that the filenames.txt and ...
0
votes
1answer
36 views

Tried Installing ZSH through cygwin and then trying to use zsh through Cmder

I tried to install Cygwin (64 bit version) on my computer, and it went through hunky-dory until at the very end, autorebase.bat failed with exit code 1. I read through the logs and they weren't too ...
1
vote
2answers
41 views

Execute a previous command in a shell and get the command directly after

Once, a colleague of mine shown me a very useful method (shortcut?) on a shell (bash? csh?) to, after executing a previous command, automatically show the command after in history. For example, ...
1
vote
2answers
121 views

Equivalent of (foo &>/dev/null &) in Windows shell

I'd like to run a particular application (let's call it foo) from the command line, but I don't want it holding up the terminal, putting any junk in the terminal from its output or error streams, and ...
1
vote
2answers
28 views

Start application from a numbered list of choices

I want to display all applications dynamically within a folder in a numbered list, and launch them by entering the number associated with the application. So far I have the easy part working, the ...
-1
votes
1answer
34 views

how to escape '$' in an awk statement in shell alias

I'm trying to write an alias that will kill all running php processes.. this is the command i got in my ~/.bash_profile alias killphp="ps aux | g [p]hp | awk '{print $3}' | xargs kill -9" this ...
0
votes
1answer
27 views

Change value in config without opening

Is it possible to change/uncomment value in linux configs without opening and go to line? Example: In php.ini we had expose_php = On and we want turn it off: $: magic_cmd "expose_php = Off"
1
vote
0answers
34 views

Recursive search occurs instead of last command when using up arrow.

I'm using an internal product "shell" based on spring shell. When I press the up arrow to get my last command, instead I get (reverse-i-search)`': Retrieving the last command works for all my ...
2
votes
3answers
197 views

What exactly do the sudo -s command? and how is it used in this example?

I have the following doubt. In a tutorial related to a software installation that I am following say that I have to execute the following commands (I am doing it into an ssh shell, so this list of ...
0
votes
1answer
42 views

How to use find to fill in variable in Shell script

I am making simple Shell script form some boring-ever-repeating job. Script changes directory correctly, and now I want to run other scripts based on argument I typed when running script. Other ...
0
votes
1answer
28 views

Sed is not Interpreting Pipes Correctly

OK, this is hard to explain, so I will give a reproducible example: I have a text file test.txt contains the line: somesetting-parameter /an/old/path I want to replace it with a path I can get via ...
0
votes
0answers
10 views

Output of usbmon ( length field )?

In http://www.mjmwired.net/kernel/Documentation/usb/usbmon.txt#163 it is written that before status tag ,there is data length field ,in my output for usbmon http://pastebin.com/b6U7Je7h please ...
3
votes
1answer
281 views

How to use usbmon for knowing amount of data transferred from usb (pendrive )?

Please someone explain me in simple terms how to use usbmon to track the amount of data transferred from pendrive ?
0
votes
2answers
31 views

CLI tool to graphically select lines during piped commands

Is there a tool similar to choose that I can plug into chain of commands that will let me select (multiple) lines for the next step? choose unfortunately doesn't "pass on" the line you select, ...
0
votes
3answers
268 views

How can I add a program path to the Windows environment variables for easy command line access?

Let's say I want to add the following path to the Windows environment variables: C:\Program Files (x86)\VideoLAN\VLC\vlc.exe Such that I can simply type the following from a command line without using ...
0
votes
1answer
118 views

How do you run a command as another user on Linux?

I have access to a linux server where I can sudo to 'foo' like this without a password: sudo su - foo Once I am the 'foo' user I am able to run a script like this: /dir/foo_user_script.sh The ...
1
vote
2answers
82 views

Can I use shell: commands to change directory in CMD?

I am trying to create a batch file which installs favorites on all company PCs and Notebooks. Is it possible to change the directory in CMD using shell:favorites? I need this because on the ...
3
votes
1answer
219 views

#!/bin/bash -e :: what is `-e`? other arguments?

I am a shell script coder that always opt to use shell as top level as part of my belt in creating website apps on the fly and have relied on my bash scripts if I want a project to be implemented ...
2
votes
2answers
165 views

Linking multiple files

In bash, say I want to link some but not all files from a directory, e.g., ln -s /dir/file1 /dir/file2 ... /other/dir but the format of the names of the files do not follow some simple rule, so we ...
0
votes
2answers
49 views

Zsh: how to auto complete after a command?

everyone. It's a little difficult to explain what I want to do. I want to create a script 'example', which can input long commands for you after you run it with short parameters. For example, $ ...
0
votes
2answers
134 views

Difference between “ls -lh” & “ls -lh | tail -n +2”

I was going through the split command article on internet and came across this Linux command ls -lh | tail -n +2 for listing files. Is it any better than ls -ltrh (which shows almost the same listing) ...
-1
votes
3answers
69 views

Create one file per line via shell

I have a file containing list of filenames, like this file1.cfg file2.cfg file3.cfg I want, using the linux terminal, to split this into n files with the given filename, each also containing the ...
3
votes
2answers
157 views

What is the equivalent of bash's !$ and !! in the fish shell?

I've been using bash for a decade or so and have gotten used to being able to type !$ to repeat the last argument, e.g.: $ mkdir foo $ cd !$ cd foo (That last line is printed by the shell to tell ...
0
votes
1answer
76 views

bash: Running a program from the console without holding it up or line noise

I would like to run programs (for example, opening PDFs in Evince) from my bash shell. However, when I do this the simplest way (evince filename.pdf), the shell doesn't let me input anything until I ...
0
votes
1answer
59 views

Bash single quotes in find command

I'm having some troubles getting a shell script to work. I'm trying to dynamically generate the find command based on user input and I'm running into the problem that my variables in the find command ...
1
vote
1answer
151 views

Infinite loop in Terminal (ksh) to launch commands

I'm trying to create a loop in terminal to launch every second during the execution of an script the following command. I don't want to create the loop in .sh script file, i'm trying to do in the ...
0
votes
1answer
146 views

zsh (or maybe oh-my-zsh) history gets confused with multi-line commands

if I use the up arrow in a zsh session, as you'd expect I get previous commands, from newest to oldest. Now (whether it's zsh or oh-my-zsh doing this I don't know), but if I type the start of a line ...
2
votes
1answer
51 views

Hex of filesize

I am following a tutorial on few kernel dev. I encountered an operation where I have to use dd like dd ... if=PBL.bin of=... count=block_number The block_number variable is defined to be as The ...
0
votes
1answer
150 views

ZSH: Where to place environment variable so that launched application can pick it up?

I need an environment variable KEY="value" made available to a GUI application before starting it. The launcher file (the one that places the icon on the desktop and sidebar in Ubuntu) has a value of ...
2
votes
2answers
184 views

How to set specific file permissions when redirecting output?

This is probably a duplicate, but all my searches are turning up questions about permission denied errors. I am running a command in a bash shell. I want to redirect output to append to a file that ...
0
votes
3answers
188 views

How to delete all hidden .swp files from terminal

How can I delete all .swp files? I tried rm *.swp but I got rm: *.swp: No such file or directory rwxr-xr-x 16 teacher staff 544 Jan 17 13:19 . drwxr-xr-x 19 teacher staff 646 Jan 16 12:48 ...
8
votes
1answer
609 views

why doesn't a bash while loop exit when piping to terminated subcommand?

Why doesn't the command below exit? Rather than exit, the loop runs indefinitely. While I discovered this behavior using a more complex setup, the simplest form of the command reduces to the ...
0
votes
1answer
59 views

Terminal scrolling from shell script

Is there any way to perform the effect of using the scroll bar in Terminal.app using a shell command? Maybe something cross-platform, that works in Linux terminal emulators too?
2
votes
0answers
91 views

Downloading and building O3D

I'm trying to get a program called O3D into my computer by following the instructions on O3D's wiki. I tried to download the project to my directory but the prompt gave me this answer: gclient is ...
0
votes
1answer
661 views

How to generate a PDF from a series of images?

I have a series of images (a scanned book, actually) that I want to make into a PDF in A4 format. Why I'm doing this: I'm helping a less computer savvy person in a different country to get a printed ...
1
vote
1answer
31 views

$(shell [foo]) in windows

I've got a makefile (a file called 'Makefile' which is run by cmake I believe), and most of the 'sample' ones I can see are just one line (and the rest appear to be stuff I don't 'yet' understand and ...
1
vote
1answer
54 views

Pre-compiled command line input in zsh

I recently set up a ubuntu 12.04 64 bit machine. I use tmux with many open windows, all of them use zsh as shell, some of them through a chroot environment that uses the same home folder of the normal ...
1
vote
1answer
93 views

How to prefix every command in shell with “sg - grp -c”?

I am using bash shell. I want to run all commands of a specific user to be run as a specific group command in the shell. How can I do it? Can anything be can be done in ~/.bashrc ?
0
votes
2answers
110 views

Mac script to copy files (execute by clicking on icon)

I have a script on my Mac Desktop: myProg.command or myProg.sh, the content is: cp "foo/foo.txt" "bar/foo.txt" The script is set as executable. The directories Desktop/foo, Desktop/bar and the ...
0
votes
1answer
48 views

Is there a free UNIX shell service that allows you to test function keys?

I am testing a program that is a terminal emulator that runs through a web browser. I'd like to use a free UNIX shell service to test the function key maps (this program can also generate a function ...
0
votes
0answers
168 views

How to close Genymotion device with shell command?

I need to close genymotion via shell command, does anyone know if it is possible to do this?
1
vote
1answer
107 views

Bash preexecute

I'm trying to write bash command wrapper, which will be patch bash current command on the fly. But i'm faced with the problem. As i'm not a good Shell user, i can't write right expression of variable ...
1
vote
1answer
157 views

How to remove files which are copied after running `make install`?

So the question is how am I supposed to uninstall or remove the files that has been installed after running the make instal? (Specially when I stop it in the middle of the process by a "Ctrl+C" or ...
0
votes
2answers
58 views

What is the difference between different “make” commands?

So after running configure file on source codes for different applications one enters make and make install to install the application. My question is what is the difference between make and make ...
1
vote
1answer
270 views

Append text with dynamic value in a text file by echo command in bash

I want to append some text in a file through a shell script. I have the following script bash -c 'echo -e "\nserver.id=$1" >> file.properties' saved in the file script.sh This is how I run ...