Translate

Archives

Sudo and Globbing

The question is how we can use the sudo utility to display a list of files in a directory to which we have absolutely no Unix filesystem privileges Consider the following directory and files contained therein: $ ls -l total 4 drwxrwx—. 2 root root 4096 May 22 21:14 demo $ su Password: XXXXXXXX # ls -l demo total 0 -rw-r–r–. 1 root root 0 May 22 21:14 file1 -rw-r–r–. 1 root root 0 May 22 21:14 file2 -rw-r–r–. 1 root root 0 May 22 21:14 file3 # exit exit Note the directory permissions are 770 and the user and

Case Insensitive File Listings

In general, Linux filenames are case-sensitive. So how case you list the files in your current directory in a case-insensitive way? Technically, you are looking to perform case-insensitive globbing. Here are some ways: # touch DEMO demo DeMo # ls -l [Dd][Ee][Mm][Oo] -rw-r–r–. 1 root root 0 Mar 24 11:39 demo -rw-r–r–. 1 root root 0 Mar 24 11:39 DeMo -rw-r–r–. 1 root root 0 Mar 24 11:39 DEMO # ls -l | grep -i demo -rw-r–r–. 1 root root 0 Mar 24 11:39 demo -rw-r–r–. 1 root root 0 Mar 24 11:39 DeMo -rw-r–r–. 1 root root 0 Mar