Tag Info

Hot answers tagged

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 ...


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' ...


6

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


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" ] || ...


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 ...


4

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 ...


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 ...


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 { ...


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.


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


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 ...


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.


2

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/*


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 ...


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 ...


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

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)



Only top voted, non community-wiki answers of a minimum length are eligible