Questions tagged [slash]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
3 answers
194 views

How to pass a string containing slashes to sed without treating it as a file? (No such directory or file)

I need to pass a string containing slashes to sed to extract some values from it, but when I try to do so it treats it as a directory/file and throws a "No such directory or file" error instead. I'm ...
user avatar
0 votes
2 answers
441 views

What is a "path name component"? [duplicate]

I am not sure I correctly understood what is a path name component (or perhaps better written; path name-component) which I understand to be commonly abbreviated simply as "component" in the Unix &...
user avatar
10 votes
4 answers
1k views

Where can I find a definitive answer for what `*/` means in Bash or Zsh?

I was trying to look into some reference from O'Reilly about Unix and Bash about the meaning of */ but couldn't find any. We can echo */ and see all the directories. It seems like it means all "...
user avatar
  • 2,667
6 votes
1 answer
492 views

Escape a mm/dd/YY backup date in a file name

I have been trying to: cp file.csv file.$(date +%D).csv But it fails because the filenames is: file.03/27/19.csv with the slash of separate directories. And I have been trying again to: cp file....
user avatar
3 votes
1 answer
2k views

What does the slash do in 'case $1/$2' in shell script (/bin/sh)

Found this example on the arch wiki #!/bin/sh case $1/$2 in pre/*) echo "Going to $2..." ;; post/*) echo "Waking up from $2..." ;; esac and can't make out if it's a logical ...
user avatar
2 votes
1 answer
2k views

How to remove the trailing slash from a variable which defines a directory from a time test output

Ubuntu 16.04 Even thou the output of for client in */; do doesn't produce a trailing slash, the trailing slash appears if I echo the variable $client while performing a time test on the file, within ...
user avatar
3 votes
3 answers
1k views

How does the shell interpret ././command-name?

I have a binary file named hello2 in my current working directory. To execute it I need to press ./hello2 and it shows the output. But when I use the following command ././hello2 it still works. ...
user avatar
  • 407
2 votes
3 answers
113 views

Is there any difference w/ v/s w/o "./" in a relative path?

Is there any subtle difference between: file and ./file as a relative path?
user avatar
2 votes
2 answers
480 views

Why can a softlink to a directory be created with or without the trailing slash?

I have found that when creating a symbolic link to a folder it is produced with or without the trailing slash based on your input. for example: $ ln -sfv /ln-test/FOLDER/ test-tail test-tail -> /...
user avatar
  • 133
0 votes
1 answer
7k views

Forward slash not detected in "grep" command

I have a sql query in a text file and it has a line that looks like: PARTITION BY (date_key // 100000000); Now, I want to replace the two forward slashes with the word "DIV". For that, I did the ...
user avatar
  • 149
23 votes
3 answers
2k views

Kernighan and Pike challenge: how to put a slash in a filename?

I've just encounter the following question in Unix Programming Environment, the Kernighan and Pike's classic book on Unix (I found the below text on p. 79 of year 1984 edition, ISBN:0-13-937699-2): ...
user avatar
26 votes
3 answers
2k views

How to delete a file named "filen/ame" (with slash) on an ext4 filesystem in debugfs?

Playing with e2fsprogs debugfs, by change/accident, a file named filen/ame was created. Obviously the forward slash character / serves as the special separator character in pathnames. Still using ...
user avatar
3 votes
1 answer
12k views

Bash script error trying to write to file: no such file or directory

I'm getting an error with a very simple script. The script should run pg_dumpall and write the output to a file but I'm getting an error that the resulting file doesn't exist. I know it doesn't exist, ...
user avatar
  • 65
1 vote
1 answer
100 views

Any reason why find does not merge multiple slashes into one?

Is it true that find is not supposed to be doing even the most simple path unification/simplifications operations, such as coalescing multiple successive slashes together (which would be equivalent to ...
user avatar
  • 5,691
1 vote
3 answers
6k views

How to create a directory with '/' in unix?

I want to create a directory with name as below A3456/90876/IN AS%90876 JI KOL
user avatar
5 votes
2 answers
981 views

Is it ok that find displays double forward-slash?

Is it a bug that, when I find ./path/here/ I get: ./path/here//foo ./path/here//bar I know find wants me to specify the path without the trailing slash, but surely it can detect the path that tab-...
user avatar
6 votes
3 answers
4k views

What does dot forward slash forward slash mean (.//)?

I was querrying a server using a command like this: find ./ -type f -name 'filename" I got many files starting with .//library or .//user What do these things mean?
user avatar
2 votes
2 answers
660 views

Get `scp path/` behave like `rsync path/`

I have local file structure: /tmp/24 /dir1 /file1 /file2 /dir2 /file3 /file4 and I want to upload it to remote compute. When I use rsync /tmp/24 host:/target ...
user avatar
  • 861
2 votes
0 answers
320 views

cd with double slash hangs forever on Mac OS X Terminal

If I type cd // on the Mac OS X Terminal (Version 2.6.1 (361.1)), the prompt hangs forever. Why? Curiously that doesn't happen if I do cd / or cd ///. I am using El Captain with the bash that comes ...
user avatar
2 votes
2 answers
1k views

difference between /dir and /dir/ [duplicate]

Consider a symlink I am making to my Music directory named music. ln -s Music music now consider following sequence of commands: edward@ArchLinux:~$ readlink music Music edward@ArchLinux:~$ ...
user avatar
122 votes
9 answers
11k views

On what systems is //foo/bar different from /foo/bar?

Throughout the POSIX specification, there's provision (1, 2, 3...) to allow implementations to treat a path starting with two / specially. A POSIX application (an application written to the POSIX ...
user avatar
2 votes
3 answers
4k views

What is the difference between a directory name that ends with a slash and one that does not? [duplicate]

Is there any difference between a directory name such as mydirectory and mydirectory/ I noticed this happens when I execute ls in some directories - some of the directory names have a slash and ...
user avatar
  • 483
2 votes
4 answers
2k views

Why ./home/Desktop is incorrect and ./Desktop is correct?

I'm learning about Linux, started yesterday. I have a question which I couldn't answer from my book or Google. What is the difference between ./ and / in the shell? I'm asking this because when I ...
user avatar
2 votes
2 answers
5k views

Why do I have double slash here?

$ which mycommand /home/t/program_files/document/other edits//mycommand Why do I have double slash // here?
user avatar
  • 90.7k
1 vote
5 answers
11k views

Difference between including / at the end of a directory path and and omitting it [duplicate]

I am just wondering is there a difference in what happens when I leave / at the end of a file path for example: root /var/www/website.com/ And omitting it like: root /var/www/website.com How is ...
user avatar
63 votes
3 answers
4k views

Shebang starting with `//`?

I'm confused about following script (hello.go). //usr/bin/env go run $0 $@ ; exit package main import "fmt" func main() { fmt.Printf("hello, world\n") } It can execute. (on MacOS X 10.9.5) $ ...
user avatar
  • 723
2 votes
1 answer
625 views

When is a symlink treated as the thing it links to, and as a symlink?

When is a symlink treated as the thing it links to, and as a symlink? A symlink can links to a file of different types. For example, let mylk be a symlink which links to a dir. The following two ...
user avatar
  • 90.7k
4 votes
1 answer
747 views

Test for link with trailing slash?

I created in /tmp/test/ mkdir somedir ln -s somedir/ somelink I want to loop through only directories: for file in */ ; do if [[ -d "$file" && ! -L "$file" ]]; then echo "$file is a ...
user avatar
  • 24.9k
74 votes
4 answers
58k views

When should I use a trailing slash on a directory? [duplicate]

Possible Duplicate: How linux handles multiple path separators (/home////username///file) Most commands I use in linux behave exactly the same whether I include the trailing slash / character on ...
user avatar
5 votes
2 answers
15k views

What causes ln: //: Is a directory?

When linking a directory to root, I get this error: $ ln -s ~/inbox/ / $ ln: //: Is a directory Bash autocompletes the directory path by adding a /. I've tried escaping without success. $ ln -s ~/...
user avatar
  • 6,579
4 votes
2 answers
1k views

What does '//' mean in return from `which`

I have an executable script test under the full path /home/sawa/foo/bar/test. The directory /home/sawa/foo/bar is within $PATH, and has priority over the default ones including /usr/bin. When I do `...
user avatar
  • 852
59 votes
3 answers
19k views

unix, difference between path starting with '/' and '//' [duplicate]

In unix/linux, any number of consecutive forwardslashes in a path is generally equivalent to a single forwardslash. eg. $ cd /home/shum $ pwd /home/shum $ cd /home//shum $ pwd /home/shum $ cd /home///...
user avatar
  • 1,315
63 votes
1 answer
52k views

What do double slashes mean in UNIX path? Is `cd dir/subdir//` valid? [duplicate]

Possible Duplicate: How linux handles multiple path separators (/home////username///file) Do cd dir/subdir/ and cd dir/subdir// mean the same in UNIX? Will the later work out? Else does it have ...
user avatar
  • 837
0 votes
1 answer
843 views

Inconsistency in behavior of 'rm' when a mounted volume is involved?

If I run the following sequence of commands: mkdir dir ln -s dir link rm -r link/ I get this output: rm: cannot remove `link': Not a directory I get the warning because I could simply have issued ...
user avatar
  • 61.2k
138 votes
6 answers
26k views

How does Linux handle multiple consecutive path separators (/home////username///file)?

I'm working on a python script that passes file locations to an scp subprocess. That's all fine, but I'm in a situation where I may end up concatenating a path with a filename such that there's a ...
user avatar
  • 12.3k
15 votes
3 answers
6k views

the slash (/) after a directory name on shell commands

I have a little question here. If I have two files, say filea and fileb, mv filea fileb would delete fileb rename filea to fileb Then if I have two directories, say dira and dirb, mv dira dirb ...
user avatar
  • 19.5k