Questions tagged [slash]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
2 answers
113 views

Effect of slash (/) suffixes on symlink names for `ls` with the `-F` option

By way of example, I have a directory structure like this: $ \ls -F dir/ lnk@ $ \ls -F dir FILE $ \ls -l lnk lrwxrwxrwx 1 user group d Mon hh:mm lnk -> dir My ls command is aliased. I am using \...
Ana Nimbus's user avatar
2 votes
1 answer
153 views

/bin/sort appears to ignore forward slashes in its input

I'm running Ubuntu 20.0.4. Consider these contents of the following file (suppose the file is named input) ... /zzzzz foo bar /hij zzz xyz abc /abc ijk lmnop qwer tyuiop abc def If I run /bin/sort ...
HippoMan's user avatar
  • 535
0 votes
3 answers
486 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 ...
DMX David Cardinal's user avatar
0 votes
2 answers
881 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
11 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 "...
nonopolarity's user avatar
  • 2,979
6 votes
1 answer
598 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....
tres.14159's 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 ...
James Langham's user avatar
2 votes
1 answer
3k 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 ...
Vituvo's user avatar
  • 411
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. ...
alamin's user avatar
  • 427
2 votes
3 answers
118 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?
Marshall An's user avatar
2 votes
2 answers
629 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 -> /...
hoss's user avatar
  • 133
1 vote
1 answer
8k 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 ...
kskp's user avatar
  • 177
23 votes
3 answers
3k 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): ...
firegurafiku's user avatar
26 votes
3 answers
3k 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 ...
humanityANDpeace's user avatar
3 votes
1 answer
16k 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, ...
rijo79's user avatar
  • 65
2 votes
1 answer
115 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 ...
phk's user avatar
  • 5,893
2 votes
3 answers
7k 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
karthikeyan's user avatar
5 votes
2 answers
1k 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-...
Bobby Jack's 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?
munchschair's user avatar
2 votes
2 answers
789 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 ...
graywolf's user avatar
  • 901
2 votes
0 answers
375 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 ...
Alessandro Cosentino's 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:~$ ...
Alex Jones's user avatar
  • 6,253
124 votes
9 answers
12k 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 ...
Stéphane Chazelas's user avatar
3 votes
3 answers
5k 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 ...
farid99's user avatar
  • 523
2 votes
4 answers
3k 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 ...
Yogesh Tripathi's user avatar
3 votes
2 answers
6k 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?
Tim's user avatar
  • 99k
2 votes
5 answers
12k 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 ...
Stephen Fox's user avatar
64 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) $ ...
kawty's user avatar
  • 743
2 votes
1 answer
799 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 ...
Tim's user avatar
  • 99k
4 votes
1 answer
799 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 ...
rubo77's user avatar
  • 27.9k
82 votes
4 answers
64k 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 ...
Cory Klein's user avatar
  • 18.4k
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 ~/...
Igorio's user avatar
  • 7,299
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 `...
sawa's user avatar
  • 862
60 votes
3 answers
20k 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///...
Shum's user avatar
  • 1,335
67 votes
1 answer
58k 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 thing in UNIX? Will the latter work out? Does the ...
San's user avatar
  • 887
0 votes
1 answer
865 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 ...
tshepang's user avatar
  • 64.7k
149 votes
6 answers
28k 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 ...
Falmarri's user avatar
  • 12.9k
17 votes
3 answers
7k 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 ...
phunehehe's user avatar
  • 20k