. and / usuage

Thread Tools Search this Thread
# 1  
. and / usuage

From what I have read . is for current director and the / represents directory.

So I have a file hello.c in order to run that file I have to type
./hello which is a compiled C program. If I put a space after the ./ I recieve ./ is a directory.

However if I use the cp command
cp /home/user1/file.c .
The file will be copied to current working directory where ./ is not needed.

Anyone shed some light on what exactly ./ used for.
# 2  
/ has 2 representation:-

/ - Root directory
/ - Directory separator.

So in this case ./ means current directory and directory separator.
# 3  
Many utilities accept options and expect filenames as operands. If a filename starts with a "-", many utilities will see a filename operand and think it is a set of options instead of a filename. (For example, if you have a file named -r in a directory with other files named a, b, and c; the command
ls *

will list files a, b, and c in reverse order thinking that -r was an option requesting reversed output sort order; the command
ls -l -r

will list all files in the directory (including -r) in long format in reverse order. If you just want to see a long format listing of the file -r you can do that with either of the following commands:
ls -l -- -r
ls -l ./-r

Are we having fun yet? Smilie

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Science: Gadgets
Difficulty: Medium
The Western Electric Model 500 telephone uses tone dialing to dial phone numbers.
True or False?

5 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need Generic command for Memory usuage on Linux and Solaris

Hi, I m using the below commands to find out the RAM and SWAP Memory usage on Linux. free -m while I m using the below for Solaris prstat -cZ 1 1 Is there a generic command that I can used for both Linux and Solaris to get RAM and SWAP memory usage ? (3 Replies)
Discussion started by: mohtashims
3 Replies

2. UNIX for Dummies Questions & Answers

Alias Usuage

Hi All I am new to the Unix World.I have question about alias.I learnt that alias allows to have a small more familiar command or name to execute a long string.I understand that I use C shell command and emacs editor I tried editing the .cshrc.common file in order to set my environment... (5 Replies)
Discussion started by: Ratna_Ranjan
5 Replies

3. Solaris

Memory usuage per zone in solaris

Hello all, How can i find the memory usuage per zone in solaris. (5 Replies)
Discussion started by: sophos
5 Replies

4. HP-UX

monitor memory usuage

Hi, We have HP-UX 11.23 and i want to use glance utility to monitor the memory usuage. Can someone tell me how to sort by memory usuage in glance utility? Thx (1 Reply)
Discussion started by: rockcapri
1 Replies

5. Shell Programming and Scripting

awk usuage

can any1 guide me on simple awk to do extraction and calculation? like for example if got data in 123.data how to i extract and sort the data giving my values like: don,waiter,FnB,1500 mary,waitress,FnB,1500 alex,manager,hotel,2500 leo,ast manager,hotel,2000 how do i use this command to do... (1 Reply)
Discussion started by: crunchyuser
1 Replies

Featured Tech Videos