2
votes
1answer
38 views

wc / cat command not found

I'm trying to run some simple bash script which uses wc and cat commands. The script fails with this: wc: command not found or this (after I commented string which uses wc): cat: command not found ...
2
votes
1answer
43 views

sed, insert file before last line

The following inserting file method for sed used to be working, even before last line, but not any more. Is it a bug in the current sed? Demo of inserting file method with sed: mkdir /tmp/test ...
0
votes
1answer
15 views

Escape brackets when using SED

I would like to replace the value varchar(36) with char(36) in a file by using sed. I am trying with sed -i ’s/varchar(36)/char(6)/g’ calls_contacts.sql But the command does not execute. What am I ...
1
vote
3answers
43 views

Is there anything grep does better than ack? [closed]

I started using ack a while ago and it's amazing, but still begs the question: Is there anything grep still does better than ack? Or maybe is there something grep does that ack can't do?
0
votes
2answers
33 views

Is there a unix command to output time elapsed during a command?

I love using time to find out how long a command took to execute but when dealing with commands that execute sub-commands internally (and provide output that allows you to tell when each of those ...
10
votes
5answers
828 views

How to jump back to the first character in *nix command line?

When writing a long command in the *nix command line and having to go back to the first character, in order to add something at the beginning (for instance a nohup, when you realize the process will ...
0
votes
1answer
66 views

Delete file if number in filename less than xxxx

I have thousands files in format randomstring_XXXXXXXX.jpg where 'xxx' is unixtime (1388415305). Now I need to delete all files older than some (unixtime) date. Does anyone have a solution for this?
1
vote
2answers
38 views

How do I unset (undo) unix set -C in zsh?

This works as expected $ echo "foo" > foo $ cat foo # foo $ echo "updated" > foo $ cat foo # updated From man set -C If set, bash does not overwrite an ...
0
votes
0answers
16 views

How can I use zgrep to take a file with IPs and recursively search another path, then take matching lines and correlate them into a single txt file?

How can I use zgrep to take a file with IPs and recursively search another path, then take matching lines and correlate them into a single text file? The command I have been using to find a single IP ...
2
votes
3answers
85 views

rm -rf doesn't work for an empty directory [closed]

In terminal I try to delete a directory but that doesn't work: myuser$ rm -rf foo/ rm: foo/: Directory not empty In my main directory I have only foo : myuser$ ls foo I haven't any problem with ...
0
votes
1answer
130 views

vi Error | Out of memory saving lines for undo - try using ed

While executing the following command on a large file: vi largeFile.log I get the following error: Out of memory saving lines for undo - try using ed My environment is: AIX6 I cannot add any ...
0
votes
1answer
102 views

Piping tail -f into awk

Greeting, I am trying to pipe tail -f into awk to monitor a logfile in realtime, but according to examples, there should be not problem but I can't get it to work. here is the command I'm running ...
0
votes
2answers
27 views

File sorting confusion

Q1. I have a command and I'm confused why it's sorting the filesizes by Kilobytes then Megabytes? $ find ~ -maxdepth 1 -size +1024c -type f -exec du -h {} \; | sort -nr 80K /home/sl6/S3401636/Lab 4- ...
0
votes
1answer
42 views

7z commandline: test archive and only show failures?

What is the easiest way to get only the failures from 7z when testing an archive for integrity? Looking at the command-line options, there seems to be no verbose or non-verbose option (i.e. there ...
0
votes
1answer
41 views

Getopts - command with multiple options

I have a command script i'm making and wondering how do i go about combining multiple options the general usage of the command is as follows: Usage: myCommand [-fpr] [-n count] [-s size] [-u user] ...
4
votes
3answers
75 views

Using Unix's find command to find directories matching name but not subdirectories with same name

Edited: I mistakenly misrepresented my problem. A more accurate example now appears below. I'd like to recursively walk all directories inside a target directory, and stop each recursive call after ...
0
votes
0answers
60 views

OpenBSD Change tty background color

Is it possible to change the background color of one or all ttys without installing any additional packages? Using a config file, or environment variable? I tried changing the text mode resolution, ...
3
votes
1answer
773 views

Unix command to get number of lines in a CSV file

I have to get the count of lines from incoming CSV files. I have used the following command to get the count. wc -l filename.csv Consider files coming with 1 record I am getting some files with * ...
0
votes
3answers
57 views

How to exec two commands in one find

I would like to find specific folders echo their name ls -l their contents My problem is that I don't know how to combine an echo {} and an ls -l {} in one find command. line for echo: sudo ...
0
votes
0answers
33 views

Exporting Variables – Reading Them Returns Blank?

Hi – I'm using Mac OS X (Mavericks), which should be UNIX compliant. In my .bash_login, I'm exporting variables for Cocos2D-X. I know this is executing, as I have a 'echo Test' line that executes ...
0
votes
0answers
35 views

Zsh prompt produces an error

I have the default prompt for oh-my-zsh, which is great when I have a git repo, but if there is no git repo its actually failing instead of putting nothing. I trapped an ascii image to err just for ...
2
votes
1answer
61 views

*nix find -type flag: can it accept multiple types?

I want to use find for getting all simlinks and regular files. I can use the -type for these individually, and I can use -o to string them together, but I apparently can't do -type fl. Is there a way ...
2
votes
1answer
111 views

How can I log all my command-line activity?

I just had a Heisenbug that completely disappeared on me. I'm convinced that something funny must have happened when I compiled my program several days or a week ago. But sadly, my Windows (MINGW) ...
4
votes
1answer
48 views

Unix /Linux show the last part of a file with line numbers

Is there a way to make tail show a line number in front of the last lines it show so that it show the growth of the file when using it in a script. e.g: when using it in a script like this one: ...
1
vote
4answers
66 views

Remove all folders that does not contain a specific name in UNIX

I'm trying to figure out my old skill in *nix. What I'm trying to achieve is to remove every folders that does not contain a specific word. This is the listing ➜ myfolder: pwd /user/myfolder ➜ ...
0
votes
1answer
47 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
3answers
460 views

Copy a list of files preserving directory structure, without scripts

Is there a way to copy a list of files, that share a common base directory, preserving their relative directory structure? The files with relative paths are listed in a text file. edit I have the ...
2
votes
1answer
195 views

Move all files in sub-directories to current directory while renaming duplicates

I have a number of subdirectories and I would like to move any files contained therein to the current directory using a one line Terminal command on the Mac. I know that my file names are not all ...
1
vote
1answer
136 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
57 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
2answers
88 views

How to use 2x$$ together linux

the questing is how to use two variables togheter.. ex. $1,$2,$3 are set numb=2 I need to use command: head $$numb that must be the same as: head $2 I tried everything, I need to know what ...
1
vote
0answers
222 views

Enable ssh service from command line (single user mode)

How can i enable the ssh service in the single user mode? I know how to do it in Terminal: systemsetup -setremotelogin on How can i do it in the single user mode? And if i reboot the system that ...
0
votes
1answer
153 views

How to call and launch EXE from linux \unix side?

I have a build process that runs on Linux and UNIX hosts. It's script -based, and at the end of the process I'd like to run an EXE file (that can run on Windows only... yes I know it's quite weird but ...
0
votes
4answers
124 views

Efficient system exploration/navigation on Linux?

I've been using unix and the command line for some time already, but my main method for navigating through files and directories is still cd path; ls; cd path; ls.... This is not effective at all. ...
0
votes
2answers
110 views

cd shortcuts: symbolic link to CDPATH dir

I found a solution to another question and posted here and wanted to implement it. On OSX, in order to create cd shortcuts, it advised creating a hidden folder with symbolic links, and then adding ...
1
vote
2answers
962 views

find command: search for files owned by many users in one command

In Linux, is there a way to do a search for files owned by multiple users (or group(s) of users) with the "find" command? Something like this? find . -user john, akido
1
vote
1answer
364 views

Entering into multiple directories in Unix and deleting a particular file

I have a list of directories that I want to go into and delete particular files. For example, the directory names I have are as below: 091513 090213 082612 071611 020908 011009 ... 062308 Each of ...
0
votes
1answer
46 views

DIff ignore arguments from a file doesn't seem to be working

When I run the following command, it doesn't seem to be ignoring what I specify in the ignore.txt file. I have tried adding some of the arguments with -x, but there are way too many to do that by ...
1
vote
3answers
240 views

Running a script where you append the errors to file and use nohup

The script works! First I type this in my CLI: php worker.php >>/home/xxx/log 2>&1 Then, I want it to run as its own process or whatever, so I add an & at the end, like this: php ...
2
votes
1answer
129 views

How can I apply cat (UNIX) command individually, to all files in a folder?

Here's the situation: My file A.csv needs to be concatenated individually with all the other *.csv's in the folder and each of the outputs needs to have the same name as the particular *.csv. How ...
0
votes
3answers
112 views

Replace word in file - UNIX command

How can I replace 'word' on my file for a counter: {"word":"resolucion","count":40723},{"word":"general","count":20976}, {"word":"","count":13334},{"word":"publica","count":12379}, ...
1
vote
2answers
574 views

Using Piping with cat and less to concatenate 2 files

I'm fairly new to Unix commands and I just have a simple question. One exercise I'm working on wants me to use piping along with cat and less to concatenate 2 directories (in this case /etc/passwd ...
-2
votes
1answer
320 views

changing ownership of files within a bash script

I have this bash script which outputs the first two files as owned by user, and the next three as owned by root: ################################################## # Variables NUM="6" #number of ...
2
votes
0answers
84 views

Is it possible to check which stream is used by the command? (bash)

I have an irritating problem: redirecting stderr does not work. I get: iptables: Chain already exists I can't be bothered to check if a chain exists already (pointless, iptables just throws an ...
1
vote
4answers
2k views

How can I stop cat output immediately despite massive output?

I'm looking for someway to stop the output to STDOUT when I realize a command is wrong. For instance, if I accidentally cat a very large file. Usually it will eventually stop if you hold down ctrl + ...
1
vote
1answer
106 views

Linux command find -print. When to I need this option?

What is the difference between: find . -name "*.txt" and find . -name "*.txt" -print ? I mean what is the use of print in find. I see that it prints the results anyway so why is this option ...
2
votes
1answer
2k views

Unix commands to get last modified date and size of file/folder (NOT LS)

I need a command that retrieves the last modified date and another that gives the size of a file. I've looked everywhere, and I cannot find commands like this. LS will not work.
18
votes
6answers
7k views

Is there a way to display a countdown or stopwatch timer in a terminal?

How can I display a real-time countdown timer on the Linux terminal? Is there an existing app or, even better, a one liner to do this?
3
votes
2answers
1k views

Efficient way to search string within file find and grep

I am searching all files containing a specific string on a filer (on an old HP-UX workstation). I do not know where the files are located in the file system (there are many directories, with hudge ...
2
votes
4answers
524 views

execute a command in all subdirectories bash

I have a directory structure composed by: iTunes/Music/${author}/${album}/${song.mp3} I implemented a script to strip my mp3 bitrate to 128 kbps using lame (which works on a single file at time). ...