Tagged Questions

Shells are used to interact with the OS and launch other applications. Most shells also have built-in commands such as directory listings and moving and copying files around the file system. Other shells, such as Bash (bash), can be heavily scripted to do a multitude of tasks.

learn more… | top users | synonyms

1
vote
0answers
12 views

Looking for Primos “name generation” code

Anyone remember Primos ? It had a shell-level thing called "name generation" which was very useful. Eg. to rename a bunch of files from part1.suffix to part1.new.suffix2 you could say rename *.suffix ...
0
votes
2answers
14 views

how to get bash prompt on login

When I connect to remote machine uisng ssh, by default it is not on bash prompt. To get bash prompt by default on login I did as below by create .cshrc file in my home directory if ($?prompt) then ...
0
votes
1answer
42 views

How to zip multiple files into separate archives?

I admit this question was asked here before: Like Zip into separate files where the person who asked didn't specify the OS he used and received no answers. I need to separate a huge directory ...
2
votes
1answer
14 views

Can tar be forced to exit on the first error?

By default, for many kinds of errors tar prints a message to stderr and then continues on its way -- the errors it calls "recoverable" errors, typically errors that relate to a single file or archive ...
2
votes
1answer
21 views

Per directory shell customisation

Is it possible to source a shell file when entering a directory, and unsource it when I leave? Ie certain project directories would be really useful to autoload some command aliases, but only in that ...
0
votes
2answers
52 views

Search for exe file within a condition

I want to search for all .exe files greater than 200 kB or smaller than 120 kB in the current folder and its subfolders. Then I want to move them to another folder called "folder" and execute in this ...
2
votes
1answer
25 views

bash completion does not work for newly added user

I added a new user in my ubuntu system with sudo useradd -d /home/peeyush -m peeyush sudo passwd peeyush The above list of commands created a new user successfuly but the new user is unable to use ...
0
votes
1answer
24 views

UTF-16 file output in cmd.exe

chcp 10000 echo hell☺ w☻rld♥! >> "UTF-16 file☺☻♥♦♣♠" OK, it creates correct file, but in the content there are question marks instead of unicode characters. How to fix it?
2
votes
1answer
54 views

Send all error messages to a text file?

I'm trying to run the following command: $ psql -d template_postgis -f /usr/local/pgsql-9.1/share/contrib/postgis-2.0/postgis.sql It produces a vast amount of error output, of which I can only ...
1
vote
0answers
27 views

tail -f updates slowly

I'm not sure why, but on my Macbook Pro running lion I get slow updates when I issue "tail -f" on a log file that is being written to. I used to use this command all the time at my last company but ...
3
votes
1answer
59 views

How can I do a recursive find and replace from the command line?

Using a shell like bash or zshell, how can I do a recursive 'find and replace'? In other words, I want to replace every occurrence of 'foo' with 'bar' in all files in this directory and its ...
3
votes
1answer
55 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
78 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 ...
0
votes
2answers
56 views

Redirect stdout to stderr in tcsh

From my understanding, the following should send 'test' on standard error in tcsh: echo test >&2 However, it instead writes 'test' to a file named 2, and when I look through my history, I ...
4
votes
3answers
154 views

Mistakenly ran chmod 644 /usr/* Any way to recover my installation?

I ran chmod 644 /usr/* on my installation of Mac OSX 10.6. Now, everything is not working, from chmod to every other command. Obviously those commands are in /usr/bin, and I do not have execute ...
2
votes
1answer
49 views

What is the shell mode started with the apostrophe?

In a (SSH) terminal session, what is the purpose of the mode started by the key sequence apostrophe <ENTER> or more literally '<ENTER>. What is the way to exit that mode?
0
votes
1answer
43 views

Remove middle folder?

I have foo/bar/myfiles and I want foo/myfiles. I was trying to git clone a repo into foo, but it made the name of the repo as a folder and put the files in there. I'm thinking of just cloning into ...
0
votes
0answers
56 views

How to recover a directory that was corrupted to a 32kb file?

I am trying to recover a 200 GB directory that was accidentally lost and "converted" to a 32kb file. It was on a FAT32, 500 GB external hard drive. Only this folder got corrupted, on a Windows ...
1
vote
2answers
66 views

Cron daemon running status check

I have a script which need to be run as cron job. In the staging environment i could run the script as a cronjob. but in the production environment it is not working, so i checked whether cron ...
0
votes
1answer
41 views

using emacs shell with gnu screen?

How can I use a bash shell in emacs (M-x shell) when I am trying to connect restart a GNU screen session (on a remote ssh connection)? When I try it, I get: avilella@remote-machine-002~$ bash ...
-2
votes
1answer
42 views

Recursively delete a line from JS files [closed]

Please help me with writing a shell script that deletes line from virus JS files recursively. String to remove: http://pastebin.com/ExjCK8GL
0
votes
0answers
19 views

Mac Terminal - Changing the $ Prefix [closed]

Possible Duplicate: Is it possible to change my terminal window prompt text? Is it possible to change the $ prefix in the terminal to another character? I would like to change $ to ⚡. ...
2
votes
0answers
36 views

Edit file description shell new menu

I've searched a lot but I cannot find a complete solution, I want to edit the file description in the explorer new file menu now i have: Explorer right-click > New > Notepad++ Document to ...
0
votes
1answer
41 views

Bash Script for loop that is breaking lines up instead of using the whole line

I am writing a very simple script and I'm getting stuck on something stupid. Basically I have text file in which each line is comprised of 3 words separated by a space. When you cat the file it ...
0
votes
3answers
33 views

What will happen when I 'cat' 'ksh'?

I used the following command in my unix box. $ cat ksh And it gave a rolling log of latin and greek letters and symbols and it kept on going with no signs of stopping. Eventually I had to close my ...
4
votes
3answers
270 views

Byobu versus gnu screen versus tmux

So far I have used konsole to manage multiple shell sessions but it seems that byobu, gnu screen, and tmux offer a better support for multiple shells. I have never used neither of them before. One of ...
2
votes
2answers
69 views

Redirect output of gnome-terminal to file

I have written a script which opens a new terminal using gnome-terminal. The output shown on gnome-terminal is correct. I want this output should be in some file. I have tried this: gnome-terminal ...
3
votes
1answer
30 views

How to save shell history more conveniently in tcsh?

I'm using tcsh quite extensively and have several questions about it's history: Is there a way to save commands for different shell tabs separately? Is there a way to save commands by session (for ...
0
votes
0answers
91 views

RT-N66U Tomato Shell Parameter Bug [closed]

Symptom: Shell scripts with a first line of "#!/bin/sh", when running, have a wrong value for "$1", about half the time. Most often what is returned is $0, with the first character removed. ...
1
vote
1answer
53 views

how to get rc shell to read .rcrc on startup on ubuntu?

I am trying to use rc as my login shell in Ubuntu (using chsh). I noticed that it does not read $HOME/.rcrc file on startup. The documentation says that if invoked as a login shell with either ...
2
votes
2answers
81 views

Convert symbolic links into corresponding target files

I have several symlinks to other files in a directory. I want to convert these links into independent files. Is there a command that does this?
1
vote
1answer
25 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 ...
0
votes
3answers
89 views

Move files using Windows shell over network using Linux

I have a Windows laptop whose display isn't working, and I have to get some data from it. I want to get access to the Windows shell in order to move some files, and all I have access to is a network ...
1
vote
2answers
19 views

Is target in ln -s must be a full path file name?

I've tried to invoke "ln" in directory ~/download as this: ln -s ./abc ~/abc [EDITED] but it does't work. I do "ls -al " in my home and get wrong link of abc. ln [OPTION]... [-T] TARGET LINK_NAME ...
0
votes
1answer
60 views

Environment Variables and Shell Rc File

I am trying to automatically establish a connection with Amazon s3 using keys. This documentation provides instructions but I am unsure of how to set environment variables and where my shell rc file ...
2
votes
1answer
46 views

Creating a batch file to launch the currently opened applications and folders

Example: If I were viewing example.txt in a Notepad and editing an image in GIMP, I'd like to generate a batch file that would launch those files using those applications after I've closed the ...
0
votes
1answer
53 views

Should we systematically use `--` when executing `rm`?

A question about the recommended usage of rm and -- Let's say I've created two files -i and xx. If I try to remove them with $ rm * I get: rm: remove regular file `xx'? n And, as explained in ...
4
votes
1answer
77 views

What does “cd !$” mean in bash, and what other substitutions like these can I use?

I've seen somebody do: cp . yy/ cd !$ the last line translated to: cd yy/ so I think !$ means "the last argument from previous line". Am I right? Are there any other substitution of this ...
1
vote
2answers
45 views

Is the zero exit status different to that of boolean logic when using the Linux shell?

I understand that if I execute a command in the shell with the ampersand operators e.g. command1&&command2 and should the first command execute successfully it does so with a zero exit status. ...
6
votes
3answers
255 views

Why I have to type “./” always before an executable to execute it in Linux?

When I compile e.g. x.c by: GCC x.c -o x To execute result I have to write: ./x And just typing: x Fails with this message: x: command not found This means Linux does not search current ...
0
votes
0answers
37 views

how to separate source code and data while minimizing directory changes during working? [closed]

This is a general software engineering problem about working on Linux. Suppose I have source code, mainly scripts. They manipulate text data, take text files as input and output. I am thinking about ...
1
vote
3answers
100 views

How come cd doesn't work in my shell script?

SOLVED I'm trying to make a shell script on my Linux Amazon-EC2 server that will start my Minecraft server but the cd command says it can't find the directory or file when I try to change to the ...
0
votes
0answers
13 views

et_start.sh for centOS

When i start the server with the command "sudo et ./et_start.sh" it opens the console with errors. ----- R_Init ----- ...loading libGL.so.1: Initializing OpenGL display ...setting mode 4: 800 600 ...
2
votes
1answer
29 views

restarting shell process in buffer

In emacs, I often have multiple shell buffers open and use rename-buffer to keep track of them. Sometimes I inadvertently close the shell by hitting too many ^D's, or I'm on a system that ...
0
votes
6answers
259 views

Why is sudo bash needed?

I was reading the following code: $ sudo bash # cd /home/ # ./gitpull.sh Why do I need the first line, what does it do exactly? What if I just did $ sudo instead of $ sudo bash ?
1
vote
1answer
66 views

cd Command Linux and Mystery Flags

Platform: CentOS 6.2 Shell:tcsh I'm playing around with cd for a BASH script, and noticed the wondrous cd - option, but was left with many questions... Why the cd -? Isn't this redundant with cd ...
0
votes
2answers
43 views

Passing optional extra environment settings to the shell at Konsole launch time

I have a bunch of different "hats" on my computer, including multiple on-the-go projects (e.g., $work, a few projects on github, some on Sourceforge, some I'm involved with, some I just follow, etc.). ...
1
vote
2answers
59 views

Retry dropped ssh connections

I use ssh -L -g, but intermittently the connection is lost, thus: $ ssh -L 8080:localhost:8080 example.com -g Last login: Tue Apr 24 07:19:04 2012 from 203.0.113.123 Read from remote host ...
2
votes
2answers
65 views

How to echo a command then run it?

How to print a command (echo it), then run it in a single command ? This is useful when you have some alias/function and wants to print what the command is before running the command. This would be ...
3
votes
2answers
64 views

Missing segfault output in Linux terminal when running with “&”

I am debugging an application that has to run with other components. I am wrapping everything in a script: #!/bin/bash ./component1 > 1.log & ./my_application & ./component2 > 2.log ...

1 2 3 4 5 20