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.

How can I reverse the order of lines in a file?

I'd like to reverse the order of lines in a text file (or stdin), preserving the contents of each line. …

shell unix command-line
How to copy files across computers using SSH and MAC OS X Terminal

I'm trying to copy my .profile, .rvm and .ssh folders/files to a new computer and keep getting a "not …

macos unix file terminal copying
Linux: copy and create destination dir if it does not exist

I want a command (or probably an option to cp) that creates the destination directory if it does not exist. …

linux bash shell unix cp
How can I format my grep output to show line numbers at the end of the line, and also the hit count?

I'm using grep to match string in a file. Here is an example file: example one, example two null, example …

linux bash unix grep
Display filename before matching line

How can I get grep to display the filename before the matching lines in its output?

unix grep
How to assign name for a screen?

I'm using the screen multiplexer tool on the command shell and open a lot of screens. I then forget which …

linux unix shell gnu-screen
How to display line numbers in 'less' (GNU)

What is the command to make less display line numbers in the left column?

unix gnu
How to check if a file is empty in Bash?

I have a file called diff.txt. I Want to check whether it is empty. I wrote a bash script …

linux bash unix file-handling is-empty
Subtract two variables in Bash

I have the script below to subtract the counts of files between two directories but the COUNT= expression does not …

bash shell unix
Can I export a variable to the environment from a bash script without sourcing it?

Suppose that I have this script export.bash: #! /usr/bin/env bash export VAR="HELLO, VARIABLE" When I execute the …

bash shell unix environment-variables