Tag Info

New answers tagged

0

I had similar issues. Do you have Gnome, KDE or some kind of Xwindow DM?. If you do open your file broser and remove the file from there. It should work. I would like to see a solution from the command line, but in my case and after losing a lot of time trying to figure out how to remove it from the command line I found that it was as simple as removing ...


2

The following excerpt from this essay potentially explains why that directory refuses to be deleted: NFSv4 requires that all filenames be exchanged using UTF-8 over the wire. The NFSv4 specification, RFC 3530, says that filenames should be UTF-8 encoded in section 1.4.3: “In a slight departure, file and directory names are encoded with UTF-8 to deal with ...


0

Have you tried to get the inode of that file with stat: stat mike* That should give you the inode number (and other data), and then you could try to delete it.


0

Have you tried using rm -rf ./mikeaâcnt or rm -rf "./mikeaâcnt" or an absolute path? Also instead of rm, try rmdir ./mikeaâcnt.


0

After getting the correct hex code of file / folder name (using whatever method one sees fit, I may choose ls --show-control-chars | xxd), some special construct should be used to address such characters when running under bash: rmdir $'mikea\xc3\xa2\xc2\x81\xc2\x84cnt' Otherwise backslashes are treated as vanilla backslash.


6

One way to delete files/direcories like this is by their inode-reference. To find the inodes for elements in current dir: ls -i 14813568 mikeaâcnt To delete this: find . -inum 14813568 -delete


5

You should not use non-ASCII characters in the command line since as you could see, for some reason, they won't necessarily correspond to the filename (Unicode has various ways for expressing accented letters). Something like: rm -rf mike* should work since the filename is directly generated by the shell. But make sure there's only one match (do an echo ...


2

I have personally tested using find's -exec directive: $ mkdir -p mikeaâcnt $ ls mikeaâcnt $ find -maxdepth 1 -type d -empty -exec rm -rf {} + $ ls $ The folder was correctly created and correctly removed. As pointed out by @Igeorget, there's an even simpler method if you have GNU find: $ find -maxdepth 1 -type d -empty -delete I also tested this ...


2

Regex aren't involved here. Wildcards in bash (like most other shells) only match files based on the file names, not based on the file type or other characteristics. There is one way to match by type: adding / at the end of the pattern makes it only match directories or symbolic links to directories. This way, you can move directories, then move what's left, ...


4

You could use something like find . -maxdepth 1 \( ! -type d \) -exec sh -c 'mv "$@" MYDIR' _ {} \; First we use find to look only within the current directoy, then we ignore directories by using ! -type d finally we execute sh and move everything to the destination dir. You might try {} + at the end which will be faster.


3

An easy way is to just create a directory in /tmp and use a symlink: mkdir /tmp/mine ln -s /tmp/mine /home/me/tmp You may want to chmod 700 /tmp/mine to keep it private. If you instead want to mount an actual separate tmpfs directory: mount -t tmpfs -o size=100M tmpfs /home/me/tmp You need root privileges to do this, but normal permissions rules apply ...


1

Using the @reboot cron keyword, this will execute the specified command once after the machine got booted every time. @reboot rm -rf /dev/tmp/*


2

Depending on what you want exactly to do, and the structure of your files, other possibilites may be available, such as : ls -1tq /dir/*/readme.txt | head -n 1 Returns the full name of the most recent readme.txt found in any subdirectory (not recursive) of /dir/ The usage of * as part of the path (not just as part of a filename) often being underknown, I ...


1

For more portability, you can use perl: $ perl -MList::Util=reduce -le ' BEGIN { $dir = "." } opendir DIR,$dir; print shift @{(reduce {$a->[1] > $b->[1] ? $a : $b} map {[$_,(stat($_))[9]]} grep { -d and !/^..?$/ } readdir DIR)} ' .Skype Change $dir to whatever directory you want ...


0

Hardlink creation on directories would be unrevertable. Suppose we have : /dir1 ├──this.txt ├──directory │ └──subfiles └──etc I hardlink it to /dir2. So /dir2 now also contains all these files and directories What if I change my mind? I can't just rmdir /dir2 (because it is non empty) And if I recursively deletes in /dir2... it will be deleted from ...


3

You don't need any elaborate pipelines for this. Moreover, you don't need to find anything - you already know where each file is, you just don't know which of them is newest. This is easily handled. To demo, here's my little test: mkdir ./dir1 ./dir2 ./dir3 for d in 1 2 3 do touch ./dir$d/samefile sleep 1 done That creates the test set. Now, which ...


0

Short answer: look into man find and the 'time' options. This will locate the file(s), then use the -printf option to display the path of the file(s), which then can be used for cd <path> One way to use find and extract DIR of the last accessed file (within the last 24h) in current dir and its sub directories lastAccDir="$(find 2>/dev/null . -type ...


-1

First we create directories: mkdir -p /storage/campaigns mkdir /storage/financials mkdir /storage/public Then we set the permissions chmod 070 /storage/campaigns chmod 070 /storage/financials chmod 474 /storage/public And now we set the groups: chgrp -R marketing campaigns chgrp -R finance financials chgrp -R finance public


-1

Create the directories mkdir -p /storage/campaigns /storage/financials /storage/public Set the groups chgrp marketing /storage/campaigns chgrp finance /storage/financials chgrp finance /storage/public Set the group permissions chmod 770 /storage/campaigns /storage/financials chmod 774 /storage/public


1

Are you familiar with Vim? If yes, then have a look at Ranger. It's a very fast text-based file manager, and uses Vim-like shortcuts. Move around with hjkl. To bookmark current directory, press m, then the key to store the bookmark under. To access the bookmark, press ', then the key you bookmarked it under. To create a directory simply type :mkdir ...


3

As you have said, directory hard links are not possible. Perhaps you could move the original directory to a different location, such as a hidden folder, and make both of your directories soft links to the real location. That way you could rename them freely, and the links would still be valid. This shell alias may help: function mkdirlink { ...


6

Command Line Tools I use autojump myself and I also depend on many aliases for navigating at the command line, e.g.: alias b='cd -' alias c='cd ~/Dropbox/95_2014/work/code' alias d='~/Dropbox' alias lnk='cd ~/Dropnot/webs/rails_apps/linker' alias n='cd ~/Dropnot' alias play='cd ~/play/' alias q='cd ~/Dropbox/95_2014/work/code/ruby__rails/ruby/ruby_quiz' ...


3

As for a GUI solution I use and suggest Thunar (it's of course available for other desktops too). It's fast, lightweight and stable, it's memory footprint is almost unnoticeable (~70 MiB on 30+ tabs on two separate windows). Some of its features include: Tab navigation. Drag/drop Bookmarks. Select files by pattern (Ctrl+S). Batch file and directory ...


5

Personally, I have never understood the use of fully-fledged file managers. I deeply prefer to use coreutils for file management. As a result, my solution for this would be to suggest a directory management utility. There are a myriad of these, and I have never personally found a use for them so I can make no personal recommendation. But, below are a few ...


0

When the last argument to cp is an existing directory, cp copies the source file(s) into that directory. mv does the same. You would like to merge the source directory with the target directory. But that would only make sense when the source is a directory. So when you run cp somefile existing-directory/, you end up with existing-directory/somefile; and ...


1

While Michael Homer already wrote what happened, here's why it happened (given your comment on his answer I think you already know, but others coming across this question might not). The command you issued was ls -al /usr/lib/*valgrind* The stars are interpreted by the shell even before ls is executed, by replacing it with a list of filenames matching ...


1

There are 3 forms of cp and mv cp/mv [OPTION]... [-T] SOURCE DEST cp/mv [OPTION]... SOURCE... DIRECTORY cp/mv [OPTION]... -t DIRECTORY SOURCE... Form 1 and 2 are of form cp/mv a b, in form 2 b is a existing directory, but in form 1 b is a destination. To avoid this ambiguity do not use form 2. Use form 1 for what you are trying to do, with -T. Use form 3 ...


1

If you want to copy an entire directory as SOURCE, cp wants a directory as DESTINATION, to know where it should be stored. The mistake you did was not removing the directory /var/www/release/wiki after your mkdir and cp -rp ... test. So cp -r ... did, what you told it to do: Copy ../html/wiki into the existing directory ./wiki and thus creating another ...


7

This output: $ ls -al /usr/lib/*valgrind* drwxr-xr-x 2 root root 4096 Sep 30 00:01 . drwxr-xr-x 24 root root 12288 Sep 30 00:00 .. -rwxr-xr-x 1 root root 1816444 Jun 6 2014 cachegrind-x86-linux indicates that there is a directory named /usr/lib/*valgrind* (most likely just /usr/lib/valgrind) which you're ...


2

My suggestion: GLOBIGNORE=$(echo */) # create list of directories with globbing GLOBIGNORE=${GLOBIGNORE//:/\\:} # escape possible ":" with "\" to allow # the separator ":" in directory names GLOBIGNORE=${GLOBIGNORE//\/ /:} # replace "/ " with separator ":" GLOBIGNORE=${GLOBIGNORE%/} # remove trailing "/" ...


2

This should really be a comment, but I don't have enough points. That said - I'm not sure which of the 2 options to you want to achieve - bash globing that excludes based on filesystem attributes, or a way to display only files in a directory? If the first, I'm not sure that's possible. Globing just expands, and filenames are a base in any directory - bash ...


5

The reason */ matches directories is that the final / restricts matches to directories. This effect is only triggered when the / is after a pattern, you can't use / inside parentheses in !(*/). There's no feature built into bash to do what you want. You can make a loop over all files and build an array. non_directories=() for x in *; do [ -d "$x" ] || ...


6

find . -maxdepth 1 ! -type d Details: -maxdepth 1 restricts the search to the current directory ! -type d eliminates directories


3

Sort of long winded, but: for f in *; do if [ ! -d "$f" ]; then echo "$f"; fi; done -d is a file test operator to check if the argument is a directory. The above could also be shortened to for f in *; do [ ! -d "$f" ] && echo "$f"; done


0

There is no really good way to tell from a system perspective which is the last created directory, as as been pointed out ctime and mtime are not reliable indicators. You could procedurally do this, by creating a file called .create-time when you create your directory and then never modify or change the permission on this file and use the file as your guide ...


1

In Linux, you can't get the created date of file. ctime is not created date. It changes when your file is updated content or metadata. In Mac OSX, you can use option -U: ls -tU So you can try: cd $(ls -tU parent/cv* | head -n 1)


0

There are many ways to find the latest file/directory, depending on which tools you have at your disposal and how portable you want to be.


-2

Simple command to find hidden and non hidden files and directory $ ls -a


0

Make sure bin subdirectories of both packages (libxml2/libxslt) are on your PATH. They contain *-config scripts which are used during compilation of lxml to find out where libxml2/libxslt were installed. [pdobrogost@host /]$ echo $PATH (...):/opt/libxslt-1.1.27/bin:/opt/libxml2-2.6.32/bin:(...) [pdobrogost@host /]$ which xml2-config && which ...


2

ls -al is great for checking to see if there are any hidden directories. Barring that rm -rf removes recursively and forces the removal, keep in mind that rm -rf \ will delete everything. Depending on distro this may throw an error, or demo your entire file system. Ubuntu normally doesn't let you do an rm to your root filesystem.


3

Based on the output you're showing in your question the directory gamesForAdmin is not empty, so rmdir cannot remove this directory. To remove it you'll need to use rm -fr instead. Try this: sudo rm -rf gamesForAdmin which should fix you right up.


5

Your folder can have some hidden files (ls doesn't show dot files by default, i.e. files whose name begins with . are hidden). Run: ls -la gamesForAdmin to check if there is any hidden files in it. Updated According to your result ls -la, your directory is not empty, so rmdir can not remove it, rmdir only work with empty directory. To remove it, you ...



Top 50 recent answers are included