Most Popular

1500 questions
157
votes
2 answers

How do we specify multiple ignore patterns for `tree` command?

I need to print the directory structure of our production system and I would like to remove some specific directories from the tree? How do we specify multiple ignore patterns for tree command?
Bharat Sinha
  • 1,713
  • 2
  • 12
  • 8
157
votes
3 answers

How to change ownership of symbolic links?

I am facing some issue with creating soft links. Following is the original file. $ ls -l /etc/init.d/jboss -rwxr-xr-x 1 askar admin 4972 Mar 11 2014 /etc/init.d/jboss Link creation is failing with a permission issue for the owner of the file: ln…
Zama Ques
  • 3,186
  • 12
  • 39
  • 54
157
votes
10 answers

How do I remotely edit files via ssh?

I have to edit some files placed on some server I could reach via ssh. I would prefer to edit these files in customized vim on my workstation (I have not rights to change vim settings on remote server). Sometimes I would like to edit a file with…
Loom
  • 3,863
  • 11
  • 30
  • 44
156
votes
16 answers

How to insert text before the first line of a file?

I've been looking around sed command to add text into a file in a specific line. This works adding text after line 1: sed '1 a\ But I want to add it before line 1. It would be: sed '0 a\ but I get this error: invalid usage of line address 0. Any…
Manolo
  • 1,697
  • 2
  • 11
  • 11
156
votes
2 answers

Any way to encode the url in curl command?

I have some url which has space in it's query param. I want to use this in curl, e.g. curl -G "http://localhost:30001/data?zip=47401&utc_begin=2013-8-1 00:00:00&utc_end=2013-8-2 00:00:00&country_code=USA" which gives out Malformed Request-Line As…
Aashish P.
  • 1,561
  • 2
  • 10
  • 3
156
votes
3 answers

How to see process created by specific user in Unix/linux

I want to see list of process created by specific user or group of user in Linux Can I do it using ps command or is there any other command to achieve this?
156
votes
2 answers

Do parentheses really put the command in a subshell?

From what I've read, putting a command in parentheses should run it in a subshell, similar to running a script. If this is true, how does it see the variable x if x isn't exported? x=1 Running (echo $x) on the command line results in 1 Running…
Igorio
  • 7,279
  • 7
  • 20
  • 11
155
votes
4 answers

Where should a local executable be placed?

I have an executable for the perforce version control client (p4). I can't place it in /opt/local because I don't have root privileges. Is there a standard location where it needs to be placed under $HOME? Does the File System Hierarchy have a…
155
votes
5 answers

How do I attach a terminal to a detached process?

I have detached a process from my terminal, like this: $ process & That terminal is now long closed, but process is still running, and I want to send some commands to that process's stdin. Is that possible?
Rogach
  • 6,150
  • 11
  • 38
  • 41
155
votes
7 answers

Why are hard links to directories not allowed in UNIX/Linux?

I read in text books that Unix/Linux doesn't allow hard links to directories but does allow soft links. Is it because, when we have cycles and if we create hard links, and after some time we delete the original file, it will point to some garbage…
user3539
  • 4,288
  • 9
  • 34
  • 44
155
votes
8 answers

Clone ownership and permissions from another file?

Is there a command or flag to clone the user/group ownership and permissions on a file from another file? To make the perms and ownership exactly those of another file?
user394
  • 14,194
  • 21
  • 66
  • 93
155
votes
16 answers

How do I repeat the last command without using the arrow keys?

I know I can use Up to iterate through previous commands. Running the last command simply involves Up + Enter. However, I was thinking of buying the Happy Hacking Keyboard as I spend a lot of time in vim. This keyboard has no arrow keys, and the…
quant
  • 4,061
  • 10
  • 34
  • 50
154
votes
19 answers

Decoding URL encoding (percent encoding)

I want to decode URL encoding, is there any built-in tool for doing this or could anyone provide me with a sed code that will do this? I did search a bit through unix.stackexchange.com and on the internet but I couldn't find any command line tool…
DisplayName
  • 11,468
  • 20
  • 73
  • 115
153
votes
4 answers

How do SO (shared object) numbers work?

I'm aware that shared objects under Linux use "so numbers", namely that different versions of a shared object are given different extensions, for example: example.so.1 example.so.2 I understand the idea is to have two distinct files such that two…
user119
153
votes
2 answers

SSH Key Permissions chmod settings?

I need to use SSH on my machine to access my website and its databases (setting up a symbolic link- but I digress). Following problem I enter the command: ssh-keygen -t dsa To generate public/private dsa key pair. I save it in the default…
crissixpaul
  • 1,631
  • 2
  • 10
  • 5