Hot answers tagged

6

By default, hidden files (i.e. those starting with a period) are excluded from the bash shell's glob expansion. However you can alter that using the dotglob setting e.g. $ mkdir dir $ touch dir/.hidden dir/visible $ echo dir/* dir/visible $ shopt -s dotglob $ echo dir/* dir/.hidden dir/visible You can unset the option afterwards with shopt -u dotglob


4

Assuming your local folder is synced to the remote folder this is possible. I have done it with a cron entry in Linux with: find /path/to/synchronized/folders -type f -mtime +30 -exec rm {} \; This will delete files older than 30 days.


4

Use find command with logical OR flag (-o ) and -exec . . .\+ flag find . -maxdepth 1 \( -iname "*.*" -o -iname ".*" \) -exec grep "MySearchTerm" {} \+ Explanation: find is a recursive command that searches files in specified directory. In this case , it is . the current working directory. -maxdepth flag tells us to stay only in current directory. ...


3

"Hidden files" are simply files whose name starts with a dot. In GUIs applications these files are usually not shown, whence their name. You can use shell globbing: cat {*,.*} | grep blabla The previous command include all files with no dot (*) and all files that start with a dot (.*). By the way, this is an useless use of cat, and you should instead ...


3

Yes, you can create Bookmarks. Just go inside the folder you want to bookmark and select Bookmark this location in the Bookmarks section of the top panel. Or use Ctrl + D keyboard shortcut.


2

For header1.txt: sed -n '/^header1$/,/^header2$/{/^header2$/d;p}' file >header1.txt /pattern1/,/pattern2/ this syntax of sed matches all between (and including) pattern1 and pattern2. /^header2$/d this will delete the header2 line, because it's not needed. p the rest will be printed. For header2.txt: sed -n '/^header2$/,$p' file >header2.txt ...


2

Why does my shell script choke on whitespace or other special characters? Do it thus: FILES="/home/thenok/Documents/Link to thought diary/" for f in "$FILES"/* do stat "$f" done If you use find, use its -exec command: find "/home/thenok/Documents/Link to thought diary/" -type f ! -name '*~' -exec stat {} + Never do for f in $(find ...). If you ...


2

This isn't an Ubuntu problem but a Microsoft problem. As you said, your external hard drive is formatted with NTFS which means that you're not as free to choose your file names as you are when using ext. You can't use any of these characters in file names when using NTFS: U+0000 (NUL) / (slash) : (colon) * (asterisk) ? (Question mark) " (quote) < (less ...


2

This happens when making a bootable USB is not done properly (usually when done using PowerISO)... Please format that USB. and.. follow the below-given methods to create LiveUSB If you are using Windows: You can use Universal USB Installer... For complete description: Official Ubuntu Help on creating Live USB If you already have an Ubuntu You can use ...


1

If you can be sure none of your filenames contains newlines, with bash you'd write: mapfile -t arrFiles < <(find "$folderLocation" ! -name "*~" -type f) A bash only way: shopt -s globstar nullglob extglob arrFiles=( **/!(*~) ) But that will include directories. To filter them out you could arrFiles=() for f in **/!(*~); do [[ -f $f ]] ...


1

Most likely your filesystem is slightly corrupted. The usual culprit is an unclean shutdown. When you use a file explorer it tries to access one of the corrupted directories, the kernel discovers the corruption and remounts it read-only. To verify whether this is the case open a command line immediately after the filesystem becomes read-only and type ...



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