Unix is a multitasking, multi-user computer operating system originally developed in 1969 by a group of AT&T employees at Bell Labs.

learn more… | top users | synonyms

6
votes
1answer
254 views

Multiple unix pipes not working

This first pipeline works fine (printing "c"): echo "a" | sed 's/a/b/' | sed 's/b/c/' This one does not do what I expect (nothing gets printed when I feed an "a" into my fifo ): mkfifo fifo; cat ...
6
votes
10answers
11k views

Scripting: what is the easiest to extact a value in a tag of a XML file?

I want to read a pom.xml ('Project Object Model' of Maven) and extract the version information. Here is an example: <?xml version="1.0" encoding="UTF-8"?><project ...
6
votes
3answers
5k views

How-to limit Unix FIND results number

Is there a way to limit the number of results returned by the FIND command on an unix system? We are having performance issue due to an unsually large number of files in some directories. I'm tryging ...
5
votes
5answers
2k views

How to read one line from `tail -f` through a pipeline, and then terminate?

I would like to follow changes to a file via tail -f and then print out the first line that matches a grep command before terminating. What's the simplest way to do this? So far I've been ...
5
votes
2answers
951 views

How to create a file with a “#” character in the name in Unix?

I've tried many commands already for creating a file and deleting a file with a # character, but it does not work. Can anyone tell me the command to create and then delete a file that begins with #?
5
votes
4answers
4k views

Gnu Tools for Windows

I was looking for Gnu Tools for Windows and came across two links: http://unxutils.sourceforge.net/ and http://gnuwin32.sourceforge.net/ Does anyone know what is the difference between them and ...
5
votes
5answers
230 views

Linux/Unix in Windows

What would be the best way to get the full-blown Unix/Linux bash inside Windows? I don't mean the Virtual Machine, but rather only the terminal with mounted NTFS drives. This way I could use the ...
5
votes
6answers
652 views

Commandline complete list of commands

Is there a way/command to get a listing of all the commands available on my system from the commandline prompt?
4
votes
2answers
134 views

How can I take the output of a shell script and place it in a file on the command line?

How can I take the output of a shell script and place it in a file on the command line?
3
votes
2answers
498 views

Resolving unix server disk space not adding up

I'm trying to evaluate where my disk space on my unix server is distributed. In order to see disk space current status I'm running: df -h But when trying to evaluate what is taking the disk space ...
3
votes
2answers
2k views

What does the number after Unix/Linux file permissions like “-rw-rw-r--. 1 ” mean in “ls -l” output

Can any one explain "-rw-rw-r--. 1 " and give some "detailed" information on ls -lart command. Why does the number change after "-rw-rw-r--. 1 " <----
3
votes
1answer
527 views

When does rm remove open files?

Particularly, I want to know what happens when I rm an open file and don't explicitly kill the process holding the file descriptor to that file. Will the file be removed when the system is shut down?
3
votes
3answers
15k views

Connect to WiFi network using Mac Terminal

Every time I try to find out how to do this, I find out how to do it on a linux, and it doesn't transfer. How do I connect to a WiFi network using Mac Terminal Bash?
3
votes
1answer
150 views

Editing softlinked files in UNIX

Let's say I have file A, and using 'ln -s A B', I have B. When I open, edit and save B, now B is not symlink anymore. It's just a new copy of A. Is this expected behavior? I use Mac OS X, and I ...
3
votes
3answers
3k views

How to store a Unix alias?

I know I can create an alias for untar like this alias untar=’tar -xvzf’ How do I make this persist from session to session, because it seems it is lost when I reconnect?
3
votes
2answers
2k views

Is it possible to find all files with a given inode? Efficiently?

It is possible to find all the paths to a file with a given inode, in general, using find's -inum option. But this has awful performance for typical filesystems. What options are there to improve ...
2
votes
1answer
3k 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.
2
votes
3answers
190 views

Filter file when a column is in whitelist

Suppose I have two files, File A: a,abcdef b,bcdefa c,cdefab a,defabc b,efabcd c,fabcde And File B: a b The output I'm looking for is: a,abcdef b,bcdefa a,defabc b,efabcd So, basically, I ...
2
votes
0answers
132 views

Clarification on signals (sighup), jobs, and the controlling terminal

So I've read two different perspectives and I'm trying to figure out which one is right. 1) Some sources online say that signals sent from the controlling terminal are ONLY sent to the foreground ...
2
votes
4answers
1k views

Alternatives to cd/ls for command line navigation?

I generally work a fair amount from the command line in order to launch vim, git, ssh and so on. However, I find the Finder's columnar view more natural for browsing through my files. Unfortunately, ...
2
votes
2answers
2k views

Why doesn't 'find' prune the way I think it should?

I'm running MacOSX 10.5.8 I run the following: ~/Sites/jjprof/trunk/content > find . -type d -name '*svn' -prune ./.svn ./resources/.svn ./resources/sitewide/.svn ./temporary/.svn ./users/.svn ...
2
votes
1answer
1k views

How to create custom keyboard shortcuts in vim?

For example - when coding in Perl, I need to sometimes comment out a bunch of lines. What I do is something like :80,96 s/^\(.*\)$/#\1/ I want to create a custom shortcut for this so that I can do ...
1
vote
1answer
425 views

How to batch rename files in Mac OS X?

I have the bunch of files that have names like MOV001.mpg, MOV002.mpg etc. They all have different date-time. How can I rename them so they turn into 2012 08 05 13 45 33 MOV001.mpg, 2012 09 02 23 ...
1
vote
1answer
11k views

-bash: ls: command not found at Terminal on Mac OS X

I need to start using GIT for my projects from now on and I need to use some UNIX commands. but no matter what I do, I always receive "command not found" error. I installed MacPorts, but still cant ...
1
vote
3answers
7k views

Monitor average CPU usage and RAM usage on one process linux

Is there any way to monitor one process' CPU usage and RAM usage over time on linux? I am trying to change to a cheaper VPS and need to work out what level of CPU and RAM I need!
1
vote
3answers
9k views

How to create a cron job to upload files to an FTP server

I would like to create a cron job that uploads files from a directory on my computer to my FTP server. I would like it to do it daily at midnight. I know pretty much nothing about cron, so I ...
1
vote
6answers
892 views

Super users and the home directory

The UNIX concept of a home folder was great when users shared a single computer and had no idea where or how their files were stored in the system, but does it really make sense when a typical ...
0
votes
1answer
589 views

Unable to edit files in _www group on OS X

I am using my MacBook as a local dev environment. In order to make the files publishable I had to give my web folder user and group of _www:_www using chown. I'm using another account to log into my ...
0
votes
1answer
783 views

Unix: How to one-way-sync directory with FTP directory

Is there a good command I can run from the Terminal that will one-way sync a directory with an FTP directory in a smart way? I'd like it to for example delete all files on the FTP that no longer ...
0
votes
6answers
118 views

what did I do on my linux box, used the rm incorrectly

What will this command do on unix: rm somefile ~/data I was trying to move somefile to the folder at home/data
0
votes
1answer
153 views

Pause all but x CPU-intensive tasks

I've got about 50 folders of data to process, and I've got a ruby script that processes a folder's files (which folder it processes is based on a .yml configuration file). And a computer with four ...
11
votes
2answers
11k views

Unix: How to merge two directories

Say I have two folders with various content, foo and bar. How can I merge bar into foo so that: Files in foo that are not in bar are untouched. Files in bar that are not in foo are now in foo. Files ...
8
votes
5answers
3k views

How is \$ being interpreted by grep?

When I write $ grep \$ then whatever I type on terminal, is matched and printed on terminal. How is \$ being interpreted?
7
votes
6answers
4k views

Using an index to make grep faster?

I find myself grepping the same codebase over and over. While it works great, each command takes about 10 seconds, so I am thinking about ways to make it faster. So can grep use some sort of index? I ...
5
votes
1answer
674 views

Linux/Unix - how to enable one user to `sudo` without a password

How can a user be setup to sudo (or su -) without entering a password?
4
votes
1answer
357 views

sudo -k vs. sudo -K

I know what the man page has to say about the -K and -k : ‑K The ‑K (sure kill) option is like ‑k except that it removes the user's cached credentials entirely and may not be used in ...
4
votes
3answers
4k views

What is the difference between Linux (Ubuntu) and Mac shell commands?

I use Ubuntu at work and a Mac at home. I was trying out some shell commands on my bash terminal on the Mac today but they didn't work. I was told both machines should operate UNIX commands so the ...
3
votes
1answer
3k views

BASH - merge directories when using mv

I just started using BASH, so I can move all contents of a directory to another. But the issue is, I was expecting it to merge the directories. I am using cron job to run this script. #!/bin/bash ...
3
votes
2answers
74 views

Are packages within a Linux distro interchangable?

Are the packages interchangeable "within" Linux branches? Between branches? Where is the dividing line? For example, within the Fedora branch there are various Desktop Environments, each with their ...
3
votes
1answer
2k views

Launchd execute command when folder contents modified or changed

For the past two days i've been trying to get a launchd plist to execute a script "program" when the contents of a folder on my desktop contents have modified or changed. I've gone through tons of ...
3
votes
3answers
4k views

du vs df output

Why are there differences between the outputs of the df and du commands? Why they are not accurate in output? # df -h Filesystem Size Used Avail Use% Mounted on /dev/sda3 1012M 394M 567M 42% / ...
3
votes
2answers
2k views

Multiple parameters to bash script

I need to check for user provided options in my bash script, but the options won't always be provided while calling the script. For example the possible options can be -dontbuild -donttest -dontupdate ...
3
votes
7answers
2k views

UNIX find dirs that contain a particular file (pom.xml) then execute command in that dir

I want to, from a root dir, find all dirs that contain a certain file name (pom.xml), then cd to that dir and execute a command. I can do this in a script but I was hoping to do this with a single ...
3
votes
2answers
4k views

Convert XLS to CSV in Unix

Is there an easy to compile plain C XLS (Excel sheet(s)) to CSV (or other text delimited format) converter for Linux or the BSDs that doesn't rely on Perl and installing a bunch of module perl modules ...
3
votes
2answers
104 views

Is there a specific name for the .. or . on *nix systems?

Just what it says. Do they have a name besides "those dot thingies"?
2
votes
1answer
4k views

Why do we use cp to copy files and not dd? (in unix-derivatives)

For normal file copying in *nix, I've only ever seen people use cp (eg. cp /mnt/mydevice/myfile ~/myfile), but I eventually ran into dd, which appears to do the exact same thing (dd ...
2
votes
5answers
4k views

How to grep for special character NUL (^@^@^@)

File: O000000667520994000000074720121112000000N^@^@^@ I used the below command but it doesn't work. grep "^@^@^@" *
2
votes
1answer
139 views

unable to simultaneously mount hdd and its copy on OSX

Recently, I purchased an SSD and using dd copied my OSX HDD onto that SSD. I'm able to boot from both drives when they are installed in my Macbook Pro, separately. However, if both drives are in the ...
2
votes
1answer
531 views

Why are there weird commas in my /etc/passwd file?

There are weird commas after the real-name parameter of some lines in my /etc/passwd file. kye:x:1000:100:Kye,,,:/home/kye:/bin/bash What gives? Why are they there? Can I remove them?
2
votes
4answers
2k views

Login to Oracle database without username and password

I want to login to a database by running an SQL file from a unix script without supplying username and password (as root)....is this possible? Database is oracle