LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-30-2013, 04:55 AM   #16
Tauatioti
LQ Newbie
 
Registered: Oct 2013
Posts: 18

Original Poster
Rep: Reputation: Disabled

Thanks guys for the helps
 
Old 11-30-2013, 05:27 AM   #17
Tauatioti
LQ Newbie
 
Registered: Oct 2013
Posts: 18

Original Poster
Rep: Reputation: Disabled
Hi

How can i delete hidden file inside a directory

Code:
 rm -rf directory_name/".hidden*"
rm -rf directory_name/.hidden*
but when i do
Code:
ls -a
the .hidden file is still there,

any suggestion much appreciated

thanks
 
Old 11-30-2013, 05:33 AM   #18
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389
Is this what you are looking for:
Code:
ls -la Test/
total 20
drwxr-x--- 2 druuna druuna  4096 nov 30 12:31 .
drwxr-x--- 3 druuna druuna 16384 nov 30 12:30 ..
-rw-r----- 1 druuna druuna     0 nov 30 12:31 .bar
-rw-r----- 1 druuna druuna     0 nov 30 12:31 .foo
-rw-r----- 1 druuna druuna     0 nov 30 12:31 .1fubar

$ rm Test/.[a-z0-9]]*
$ ls -la Test/
total 20
drwxr-x--- 2 druuna druuna  4096 nov 30 12:32 .
drwxr-x--- 3 druuna druuna 16384 nov 30 12:30 ..
 
Old 11-30-2013, 06:02 AM   #19
Tauatioti
LQ Newbie
 
Registered: Oct 2013
Posts: 18

Original Poster
Rep: Reputation: Disabled
i just created a hidden file using the step below

Code:
taati@taati-Dell-System-Inspiron-N7110:~/Desktop$ mkdir test
taati@taati-Dell-System-Inspiron-N7110:~/Desktop$ cd test
taati@taati-Dell-System-Inspiron-N7110:~/Desktop/test$ touch .hidden
taati@taati-Dell-System-Inspiron-N7110:~/Desktop/test$ ls 
taati@taati-Dell-System-Inspiron-N7110:~/Desktop/test$ ls -a
.  ..  .hidden
taati@taati-Dell-System-Inspiron-N7110:~/Desktop/test$
My question is how can i delete the hidden file that has been created using the single command

i already tried

rm -rf test/.*
rm -rf test/{.hidden}
rm -rf test/.??*

output
Code:
taati@taati-Dell-System-Inspiron-N7110:~/Desktop/test$ rm -rf test/.*
taati@taati-Dell-System-Inspiron-N7110:~/Desktop/test$ cd test
bash: cd: test: No such file or directory
taati@taati-Dell-System-Inspiron-N7110:~/Desktop/test$ ls -a
.  ..  .hidden
taati@taati-Dell-System-Inspiron-N7110:~/Desktop/test$ rm -rf test/{.hidden}
taati@taati-Dell-System-Inspiron-N7110:~/Desktop/test$ ls -a
.  ..  .hidden
taati@taati-Dell-System-Inspiron-N7110:~/Desktop/test$
thanks
 
Old 11-30-2013, 06:20 AM   #20
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389
My example from post #18 removes all hidden files that start with a-z or 0-9.

If you only want to delete .hidden:
Code:
$ rm test/.hidden
 
Old 11-30-2013, 06:47 AM   #21
mddnix
Member
 
Registered: Mar 2013
Distribution: Redhat, Ubuntu
Posts: 525

Rep: Reputation: 141Reputation: 141
Quote:
Originally Posted by Tauatioti View Post
i already tried

rm -rf test/.*
rm -rf test/{.hidden}
rm -rf test/.??*
You didn't try third option...

Code:
rm test/.??*
rm test/.[^.]*
And while we are in this topic, which i remembered now, and with due respect to Tauatioti, i would like to put my another question. Hope its OK with Tauatioti.

How to display all directory tree including hidden. Searched net, but could not find.

Code:
mkdir -p topdir/{1/2/3,one,.a/.b/.c}
Tried
Code:
$ shopt -s globstar

$ ls -laRd topdir/**/
drwxrwxr-x. 5 madhu madhu 4096 Nov 30 18:04 topdir/
drwxrwxr-x. 3 madhu madhu 4096 Nov 30 18:04 topdir/1/
drwxrwxr-x. 3 madhu madhu 4096 Nov 30 18:04 topdir/1/2/
drwxrwxr-x. 2 madhu madhu 4096 Nov 30 18:04 topdir/1/2/3/
drwxrwxr-x. 2 madhu madhu 4096 Nov 30 18:04 topdir/one/
But not able to resolve how to also see hidden directory tree (.a/.b/.c). I only want to know is it possible using ls, so please no find, grep and tree -ad.

Last edited by mddnix; 11-30-2013 at 06:52 AM.
 
Old 08-05-2014, 10:15 PM   #22
prithvi.jeni
LQ Newbie
 
Registered: Aug 2014
Posts: 1

Rep: Reputation: Disabled
Create Collaborative directory

Setup a collaborative directory /documents/sysadmin.
The directory should be group owned by the group sysadmins and the group should own the files inside the directory.
The directory should be readable and writeable to the group owners and others should not have any access.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to create directory in an existing directory with single command Tauatioti Linux - Newbie 2 11-30-2013 02:17 AM
[SOLVED] create many directory with single command Tauatioti Linux - Newbie 3 11-29-2013 05:36 PM
Create a bash script that verifies an existing directory? AB1826 Linux - Newbie 11 12-13-2011 09:49 AM
Is there a way to make a new directory and then cd into with single command ? mynameisthomas Linux - Newbie 4 09-13-2009 01:29 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:28 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration