Top "Unix" questions

This tag is EXCLUSIVELY for PROGRAMMING questions that are directly related to Unix; general software issues should be directed to the Unix & Linux Stack Exchange site or to Super User.

Bash tool to get nth line from a file

Is there a "canonical" way of doing that? I've been using head -n | tail -1 which does the trick, but …

bash shell unix awk sed
Delete empty lines using sed

I am trying to delete empty lines using sed: sed '/^$/d' but I have no luck with it. For …

linux unix sed
npm throws error without sudo

I just installed node and npm through the package on nodejs.org and whenever I try to search or install …

node.js unix permissions npm sudo
How to find encoding of a file via script on Linux?

I need to find the encoding of all files that are placed in a directory. Is there a way to …

file shell unix encoding
How to split a delimited string into an array in awk?

How to split the string when it contains pipe symbols | in it. I want to split them to be in …

string unix awk split
What do 'real', 'user' and 'sys' mean in the output of time(1)?

$ time foo real 0m0.003s user 0m0.000s sys 0m0.004s $ What do 'real', 'user' and 'sys' mean in the …

unix time benchmarking
How to convert DOS/Windows newline (CRLF) to Unix newline (LF) in a Bash script?

How can I programmatically (i.e., not using vi) convert DOS/Windows newlines to Unix? The dos2unix and unix2…

linux windows bash unix newline
Compare a string using sh shell

I am using SH shell and I am trying to compare a string with a variable's value but the if …

shell unix sh
How can I exclude directories from grep -R?

I want to traverse all subdirectories, except the "node_modules" directory.

linux unix grep
How can I use a Python script in the command line without cd-ing to its directory? Is it the PYTHONPATH?

How can I make any use of PYTHONPATH? When I try to run a script in the path the file …

python unix