1
vote
5answers
135 views

How to split the output into different files?

I have a input file like foo xxx yyy zzz foo xxx yyy zzz foo xxx yyy zzz foo xxx yyy zzz bar xxx yyy zzz bar xxx yyy zzz foo xxx yyy zzz .. How to split the input file by line, into foo.txt ...
1
vote
2answers
216 views

Gnu parallel & pipe

I want to send each line of a file to another program's stdin, e.g. input.txt line1 line2 line3 I want to use the gnu parallel like this (i.e. pipe each line as stdin to the more command) cat ...
0
votes
1answer
31 views

list all files with the same name in order of when they were modified

I have a directory, let's call it htdocs/live/. Many different directories are underneath this directory, each with a file commonFunctions.js living in the js directory. For example, here is the ...
-2
votes
1answer
3k views

Cannot find a valid baseurl for any repo in centos 6.4

when I want to install any repo I found this error Error: Cannot find a valid baseurl for repo: rpmfusion-free I'm using centos 6.4 I tried to check other packages I found the same error ... so ...
-1
votes
1answer
497 views

Automate git-pull, stuck with keychain

I'd like to create a cronjob to automatically run a git-pull every minute. The problem is that my repo is private, I had to create keys on my system (Ubuntu Server 12.04). I installed keychain and ...
12
votes
2answers
525 views

backslash at the beginning of a command

In Installing RVM manual I see a lot of lines starting with '\': Install RVM with ruby: $ \curl -L https://get.rvm.io | bash -s stable --ruby I'd think it is just mistype but they repeat ...
2
votes
1answer
120 views

How can I calculate the total size of an extremely large number of files with a particular extension?

I've got a directory in Linux that contains a large number of files (tens of thousands), plus directories that may contain thousands of files as well. At some point the following du command fails ...
3
votes
2answers
156 views

Rename a directory containing many files

I made a mistake in a rsync and all the files are copied long with its full path. All the files that I copied are at /var/www/photos/2012/1007/1007 Attempt 1 Now I would like to fix the paths, by ...
5
votes
2answers
241 views

Confusion over terminology SSH, Shell, Terminal, Command Prompt and Telnet

I don't usually use SSH if I can get away with it, but if I have to I do of course, and I've seemingly done this for years while still managing to remain slightly confused about these different terms ...
0
votes
1answer
305 views

Whats the output format of “df -ki” in AIX?

I just wanna know the output format (the order of columns) when running the command df -ki in an AIX system. I dont have access to an AIX system , and since it doesnt run on x86 machines , i cant try ...
3
votes
1answer
5k views

Command: move all files inside a directory to another directory (including hidden files)?

I tried to move all files inside a directory to another directory like this: $ mv /directory_one/* /directory However, the hidden files (such as .htaccess) in /directory_one won't be moved. What ...
2
votes
1answer
2k views

tar Exiting with failure…?

i'm untaring with this command tar -pxvzf filename.tar.gz an everything seems to be going fine but, it unexpectedly exits with the error below. Is there a reason why I'm receive this error and / or ...
1
vote
2answers
462 views

How to untar a single file from an archive with randomly generated directory names?

I'm trying write a script that will download a tarball from github and extract a single file from it. However the top level directory inside the tarball has some random characters in it, which I ...
3
votes
3answers
270 views

Multiple SSH sessions in a single command

I'm trying to copy a database from one server to another. I tried using the following command and it's getting tied up on entering the ssh passwords. If I put in one server's password, it complains ...
2
votes
1answer
257 views

What does the leading dash in process cmdline mean?

I noticed a process taking full CPU on my linux server, of which the COMMAND column from top -c is -bash. cat /proc/<pid>/cmdline shows -bash too. What does the leading dash mean? More info: ...
0
votes
2answers
459 views

linux add python script to run as user

I have a Python script that is executed through PHP but the script runs under the user ubuntu. How do I change my Python script to run as the same user as my PHP script which is www-data? If this is ...
0
votes
2answers
71 views

Search and sync files from remote systems

I have a folderA remotely which has 2 subfolders folderB and folderC.I have to search for my file where it is located in the 2 subfolders(folderB and folderC) and should copy it. Is it possible with ...
1
vote
1answer
399 views

Synchronization of a directory in 2 systems using rsync

I am using rsync to copy the delta difference between the 2 systems. I want to use it in such a way it "synchronizes" the both systems based on the timestamps. I mean to say if suppose I do rsync ...
0
votes
1answer
52 views

Is there anyway to know from what console is an user logged?

Is there anyway to know from what console is an user logged ? with the who command gives me: NAME LINE TIME COMMENT atomsfat pts/0 2011-08-02 08:52 (172.206.24.244) ...
0
votes
4answers
292 views

Removing old cache files - command help

I'm trying to write a command to help clear up old cache asset files. The files are always either .css,.javascript,.css.gzip or .javascript.gzip and i want to delete all files older than 2 days old. ...
0
votes
2answers
166 views

Reset shell margins or output?

I have two problems, in both cases the problem usually occurs when I resize my terminal client xterm. When ssh'd into a server all the output from commands doesn't scroll. It doesn't happen right ...
2
votes
4answers
1k views

Copy files from sub directories into one directory

Ok I have a bunch of files in this file structure format. /backup/daily/database1/database1-2011-01-01.sql /backup/daily/database1/database1-2011-01-02.sql ...
2
votes
2answers
257 views

Please explain this BASH code (one line)

Never seen this used before in BASH: pidfile=${PIDFILE-/var/run/service.pid} The part I've never seen/used before is the ${PIDFILE- part.
1
vote
4answers
698 views

How to check / start a process | error in shell script

If want to check if a process is running and start it if not. My script below is buggy and always says that a process is running. What is wrong? $ ./check_n_run thisisnotrunning ./check_n_run: ...
4
votes
5answers
243 views

Remove a file with <Down> in the name?

So, on a CentOS box, I accidentally executed :w<Down> in a vim editor, with "<Down>" being literally pressing the down arrow key on the keyboard (rendered onscreen as "<Down>"), and ...
0
votes
3answers
434 views

Use of hyphen in shell command

I feel shy to ask this question, but if I don't I will never know, so here I am giving it a shot: I notice most shell commands use "-" for options, but I also noticed some commands do not have it. ...
1
vote
2answers
820 views

Control Key for Home & End on Command-line in Terminal on Mac OS X

What are the control keys to move the cursor to the beginning and end of the command-line? The Home and End keys don't work in Terminal on Mac OS X.
10
votes
7answers
523 views

Why is this file hidden when you run ls?

EDIT: I totally forgot about this thread. It turns out I had a bad hard disk. We had to redeploy this server for other needs so I finally got around to replacing the one bad disk and we're back in ...
4
votes
2answers
2k views

crontab - run immediately?

I have a bunch of cron jobs which run every 30mins. I'm currently doing some testing, and instead of setting the cron jobs to run every minute, is there a command which I can execute that'll run the ...
3
votes
1answer
581 views

Can i call pushd/popd and prevent it printing the stack?

After calling pushd/popd in bash, it will print off the current directory stack. Is there any way to prevent this behaviour, so that it will act 'quitely'? This sort of noise in a command is uncommon ...
1
vote
4answers
1k views

Make ls print it all on one line (like in terminal)

ls prints differently depending on whether the output is to a terminal or to something else. e.g.: $ ls . file1 file2 $ ls . | head file1 file2 Is there some way to make ls print out on one line ...
1
vote
2answers
3k views

Updating a file in a zip archive from STDIN

I want to update/freshen a file in a zip archive with the contents of stdin. So far I haven't been able to find a way to tell the zip command that the contents of stdin correspond to a particular ...
3
votes
3answers
6k views

how to undo move file in linux?

I made a mistake when moving a set of file by this command mv src/* .. instead of mv src/* .
2
votes
2answers
145 views

SED Find&Replace with “OR”

After a bit of googling / research on my own i haven't found a definitive answer, I'm looking to search the entire /var/www/html/ folder for occurances of "127.0.0.1" and replace them with a server ...
2
votes
3answers
2k views

CentOS 5 Start a PHP Script on startup

We have a CentOS 5 VPS over at slicehost. I have a couple of PHP scripts that operate email and stuff. I need a way to start these php scripts automatically on machine's reboots/startups and have ...
1
vote
9answers
9k views

How to run a .sh file in Red Hat?

when I tried to run my .sh file in Redhat using ./test.sh I am getting a error like [test@tester unix_scripts]$ ./test.sh : No such file or directory [test@tester unix_scripts]$ I have also set ...
34
votes
1answer
7k views

What is the difference between a 'Login' and an 'Interactive' bash shell

What is the difference between a ‘Login’ and an ‘Interactive’ bash shell? I have quoted Wikipedia below but can anybody give a better answer? EDIT: This is a community wiki so maybe rather than ...