**I cannot use find as I get a permission denied error
I am trying to find all the directories in /students that are world readable. This is what I have so far:
grep 'r-x' | cut -c8-10 | ls -l /students | sort | uniq -c
I don't understand why this is not working. I am telling the shell to search for occurrences of 'r-x'in the 8th-10th characters of ls -l which is other users permissions (hence world readable). Then I'm sorting the output and displaying a count of matching results with uniq -c. This is my understanding of what my shell script should do and I dont see why its not. Any help would be greatly appreciated!
For some reason it's pulling out more than just the directories readable by others.
Here is some sample output (I omitted the majority of the output)
1 drwx------ 11 lluong b20107 4096 May 26 11:15 lluong
1 drwx------ 23 stretbar b20097 4096 Dec 18 2012 stretbar
1 drwx------ 2 slawson b20003 4096 Mar 2 2013 slawson
1 drwx------ 9 fcunha b20117 4096 May 2 15:21 fcunha
1 drwxrwxrwx 10 jwu131 b20117 4096 Jul 2 19:26 jwu131
1 drwxrwxrwx 14 jadler4 b20127 4096 Oct 11 2012 jadler4
1 drwxrwxrwx 5 rlicudo1 b20067 4096 Apr 3 15:28 rlicudo1
1 drwxrwxrwx 8 lkrubner b20107 4096 Oct 25 2011 lkrubner
1 drwxrwxrwx 9 klau53 b20133 4096 Mar 12 2013 klau53
1 drwxrwx--x 14 vrobins9 b20123 4096 Mar 4 2013 vrobins9
1 drwxr-xr-x 10 aguo3 b20107 4096 Sep 24 00:13 aguo3
1 drwxr-xr-x 10 mdanial b20123 4096 Apr 10 20:46 mdanial
1 drwxr-xr-x 11 49 users 4096 Mar 28 2013 trac
1 drwxr-xr-x 11 rroger12 b20133 4096 May 8 10:00 rroger12
1 drwxr-xr-x 12 spark15 b20113 4096 May 15 2012 spark15
1 drwxr-xr-x 18 lulrich1 b20133 4096 Sep 29 22:36 lulrich1
1 drwxr-xr-x 18 yliu192 b20127 4096 Sep 26 12:19 yliu192
1 drwxr-xr-x 19 dstein b20117 4096 Feb 9 2013 dstein
1 drwxr-xr-x 20 jgarc166 b20127 4096 Sep 12 19:22 jgarc166
1 drwxr-xr-x 2 root root 16384 Nov 15 2007 lost+found
1 drwxr-xr-x 4 jsarno b20113 4096 Dec 7 2011 jsarno
1 drwxr-xr-x 6 btaylo19 b20123 4096 Mar 5 2012 btaylo19
1 drwxr-xr-x 6 dtu b20093 4096 Apr 18 19:18 dtu
1 drwxr-xr-x 6 ewu2 b20133 4096 May 4 14:30 ewu2
1 drwxr-xr-x 6 smeehan b20053 4096 Aug 29 00:19 smeehan
1 drwxr-xr-x 6 ybondar2 b20027 4096 May 23 2012 ybondar2
1 drwxr-xr-x 7 apekar b20103 4096 May 10 00:22 apekar
1 drwxr-xr-x 7 root root 4096 Mar 28 2013 tracprojects
1 drwxr-xr-x 8 jhsiao b20117 4096 Jul 26 17:33 jhsiao
1 drwxr-xr-x 8 xfeng18 b20137 4096 Sep 25 14:42 xfeng18
1 drwxr-xr-x 9 cmendo26 b20133 4096 Aug 19 01:22 cmendo26
1 drwx-----x 8 amissiro b20093 4096 May 12 16:00 amissiro
1 drwx--xr-x 17 apinchuk b20127 4096 May 26 23:03 apinchuk
1 drwx--x--x 10 aboak b20093 4096 Feb 18 2013 aboak
1 drwx--x--x 10 achan123 b20133 4096 Sep 6 21:24 achan123
1 drwx--x--x 10 acurkend b20133 4096 Jul 10 13:15 acurkend
1 drwx--x--x 10 akleinii b20133 4096 Jun 21 09:07 akleinii
1 drwx--x--x 10 akobzar b20133 4096 Sep 26 18:51 akobzar
1 drwx--x--x 10 amainett b20137 4096 Sep 22 11:17 amainett
1 drwx--x--x 10 apewther b20127 4096 Feb 6 2013 apewther
1 drwx--x--x 10 asyrtsov b20127 4096 Aug 16 10:43 asyrtsov
1 drwx--x--x 10 bernst b20135 4096 Sep 23 09:12 bernst
1 drwx--x--x 10 blilley b20123 4096 Apr 20 18:08 blilley
1 drwx--x--x 10 bmckeand b20117 4096 Aug 14 14:17 bmckeand
1 drwx--x--x 10 bsmith18 b20097 4096 Jun 10 11:19 bsmith18
1 drwx--x--x 10 bwilli18 b20117 4096 Nov 6 2012 bwilli18
1 drwx--x--x 10 cbeaton b20123 4096 May 19 04:07 cbeaton
1 drwx--x--x 10 cbeck4 b20137 4096 Sep 29 16:08 cbeck4
1 drwx--x--x 10 cho8 b20093 4096 Mar 24 2013 cho8
1 drwx--x--x 10 cliu58 b20117 4096 Oct 8 2012 cliu58
1 drwx--x--x 10 cmitch21 b20133 4096 Mar 10 2013 cmitch21
1 drwx--x--x 10 cnavarr9 b20127 4096 Apr 30 12:11 cnavarr9
1 drwx--x--x 10 dbienenf b20123 4096 Mar 20 2012 dbienenf
1 drwx--x--x 10 dlau13 b20135 4096 Jul 16 12:15 dlau13
1 drwx--x--x 10 dmok1 b20137 4096 Sep 24 12:50 dmok1
1 drwx--x--x 10 dnou b20133 4096 Apr 23 14:12 dnou
1 drwx--x--x 10 drajabar b20137 4096 Sep 3 20:20 drajabar
1 drwx--x--x 10 drodri12 b20115 4096 Sep 27 17:25 drodri12
1 drwx--x--x 10 ealberto b20113 4096 Dec 18 2012 ealberto
Rather than parsing ls, use find:
find /students -perm -o=r
This would list all files and directories in /students that are world readable.
If you don't want to recurse into subdirectories and want to find only directories, say:
find /students -maxdepth 1 -type d -perm -o=r
I am telling the shell to search for occurrences of 'r-x'in the 8th-10th characters of ls -l which is other users permissions (hence world readable).
No you're not. You're looking for "r-x" anywhere in the line and then taking the 8th through 10th characters of the lines found.
find /students -mindepth 1 -maxdepth 1 -type d -perm -005 | ...
"Why you shouldn't parse the output of ls(1)"
ls -lad */ | grep 'r-x' | sort | uniq -c
-d is used to list ONLY directories.
*/ tells *nix to search ONLY the current directory.
ls -lR |grep "^d" | cut -c8-10 | grep 'r-x' | sort | uniq -c
Related
Goal: Get Poetry working in my Anaconda3 venvs.
I'm using Anaconda3, via. Git Bash in PyCharm.
I installed Poetry using:
conda install -c conda-forge poetry
Location:
C:\Users\dabell\Anaconda3\Lib\site-packages\poetry
C:\Users\dabell\Anaconda3\Scripts\poetry.exe
$ ls -alrth
total 376K
-rw-r--r-- 3 HDS+dabell 4096 81 Mar 31 15:37 __init__.py
-rw-r--r-- 3 HDS+dabell 4096 1.4K Apr 20 06:53 poetry.py
-rw-r--r-- 3 HDS+dabell 4096 506 Apr 20 06:53 locations.py
-rw-r--r-- 3 HDS+dabell 4096 5.3K Apr 20 06:53 factory.py
-rw-r--r-- 3 HDS+dabell 4096 99 Apr 20 06:53 exceptions.py
-rw-r--r-- 3 HDS+dabell 4096 23 Apr 20 06:53 __version__.py
-rw-r--r-- 3 HDS+dabell 4096 92 Apr 20 06:53 __main__.py
drwxr-xr-x 1 HDS+dabell 4096 0 Jun 16 15:30 core/
drwxr-xr-x 1 HDS+dabell 4096 0 Jun 16 15:30 __pycache__/
drwxr-xr-x 1 HDS+dabell 4096 0 Jun 16 15:30 _vendor/
drwxr-xr-x 1 HDS+dabell 4096 0 Jun 16 15:30 config/
drwxr-xr-x 1 HDS+dabell 4096 0 Jun 16 15:30 console/
drwxr-xr-x 1 HDS+dabell 4096 0 Jun 16 15:30 inspection/
drwxr-xr-x 1 HDS+dabell 4096 0 Jun 16 15:30 installation/
drwxr-xr-x 1 HDS+dabell 4096 0 Jun 16 15:30 io/
drwxr-xr-x 1 HDS+dabell 4096 0 Jun 16 15:30 json/
drwxr-xr-x 1 HDS+dabell 4096 0 Jun 16 15:30 layouts/
drwxr-xr-x 1 HDS+dabell 4096 0 Jun 16 15:30 masonry/
drwxr-xr-x 1 HDS+dabell 4096 0 Jun 16 15:30 mixology/
drwxr-xr-x 1 HDS+dabell 4096 0 Jun 16 15:30 packages/
drwxr-xr-x 1 HDS+dabell 4096 0 Jun 16 15:30 ./
drwxr-xr-x 1 HDS+dabell 4096 0 Jun 16 15:30 publishing/
drwxr-xr-x 1 HDS+dabell 4096 0 Jun 16 15:30 puzzle/
drwxr-xr-x 1 HDS+dabell 4096 0 Jun 16 15:30 repositories/
drwxr-xr-x 1 HDS+dabell 4096 0 Jun 16 15:30 utils/
drwxr-xr-x 1 HDS+dabell 4096 0 Jun 16 15:30 version/
drwxr-xr-x 1 HDS+dabell 4096 0 Jun 16 15:30 ../
However, in (base) or in any (<venv>) - when I run:
$ poetry install pandas
bash: poetry: command not found
python -m poetry install pandas:
C:\Users\dabell\Anaconda3\envs\sdg\python.exe: No module named poetry
I added it to .bashrc, and still get the above error:
$ export PATH="$HOME/.poetry/bin:$PATH"
or
$ export PATH=C:/Users/dabell/Anaconda3/Lib/site-packages/poetry:$PATH
$ poetry install pandas
bash: poetry: command not found
$ winpty poetry install pandas
winpty: error: cannot start 'poetry': Not found in PATH
$ $HOME/.poetry/bin
bash: /c/Users/dabell/.poetry/bin: No such file or directory
HDS+dabell#PF2DCSXD MINGW64 ~/Documents/GitHub/lumada-catalog/synthetic-data-gen/sdg (daniel_sims)
$ export PATH=/C/Users/dabell/Anaconda3/Lib/site-packages/poetry:$PATH
HDS+dabell#PF2DCSXD MINGW64 ~/Documents/GitHub/lumada-catalog/synthetic-data-gen/sdg (daniel_sims)
$ poetry install pandas
bash: poetry: command not found
$ echo $PATH
/C/Users/dabell/Anaconda3/Lib/site-packages/poetry:/c/Users/dabell/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/mingw64/bin:/usr/bin:/c/Users/dabell/bin:/c/Users/dabell/Anaconda3/envs/sdg:/c/Users/dabell/Anaconda3/e
nvs/sdg/Library/mingw-w64/bin:/c/Users/dabell/Anaconda3/envs/sdg/Library/usr/bin:/c/Users/dabell/Anaconda3/envs/sdg/Library/bin:/c/Users/dabell/Anaconda3/envs/sdg/Scripts:/c/Users/dabell/Anaconda3/envs/sdg/bin:/c/User
s/dabell/Anaconda3/condabin:/c/Program Files/Common Files/Oracle/Java/javapath:/c/Program Files (x86)/Common Files/Oracle/Java/javapath:/c/WINDOWS/system32:/c/WINDOWS:/c/WINDOWS/System32/Wbem:/c/WINDOWS/System32/Windo
wsPowerShell/v1.0:/c/WINDOWS/System32/OpenSSH:/c/Program Files (x86)/gs/gs9.56.1/bin:/c/Users/dabell/AppData/Local/Programs/Python/Python310:/usr/bin/vendor_perl:/usr/bin/core_perl
In my bundled Electron app, I have it extract a node project to a location. There is a script that is supposed to run npm install and when I run it through spawn, I get an error saying npm isn't found.
The code I'm using is:
const process = spawn('my_script.sh', {shell: 'bin/bash', detached: true});
#!/bin/bash
cd <location of package.json>
npm install
In the process of trying to debug this, I've done the following:
The command is able to be run when I pull up a new command line and running which npm points to /usr/bin.
I checked the PATH variable from the script that is run by spawn (putting echo $PATH) and it returns:
/snap/<app_name>/x1/usr/sbin:
/snap/<app_name>/x1/usr/bin:
/snap/<app_name>/x1/sbin:
/snap/<app_name>/x1/bin:
/usr/local/sbin:
/usr/local/bin:
/usr/sbin:
/usr/bin:
/sbin:
/bin:
/usr/games:
/usr/local/games:
/snap/<app_name>/x1/gnome-platform/usr/bin
which includes /usr/bin
I then printed the contents of /usr/bin from the script (added ls -l /usr/bin) and noticed that npm, node, and yarn were not in it. I then opened a new window and ran the command directly and the list was substantially longer then what was returned by the script
The result of ls -l /usr/bin when ran from the script (missing node, yarn, npm, and countless other files):
-rwxr-xr-x 1 root root 51384 Jan 18 2018 [
-rwxr-xr-x 1 root root 22696 Sep 27 2018 aa-enabled
-rwxr-xr-x 1 root root 22696 Sep 27 2018 aa-exec
-rwxr-xr-x 1 root root 22608 Mar 5 11:23 addpart
-rwxr-xr-x 1 root root 35032 Jan 18 2018 arch
lrwxrwxrwx 1 root root 4 Jul 7 05:47 awk -> mawk
-rwxr-xr-x 1 root root 55512 Jan 18 2018 b2sum
-rwxr-xr-x 1 root root 39096 Jan 18 2018 base32
-rwxr-xr-x 1 root root 39096 Jan 18 2018 base64
-rwxr-xr-x 1 root root 35000 Jan 18 2018 basename
-rwxr-xr-x 1 root root 7115 Jun 6 2019 bashbug
-rwxr-xr-x 1 root root 34952 May 3 06:30 bootctl
-rwxr-xr-x 1 root root 67672 May 3 06:30 busctl
lrwxrwxrwx 1 root root 3 May 23 2018 captoinfo -> tic
-rwxr-xr-x 1 root root 3329 Jun 4 12:25 catchsegv
-rwxr-xr-x 1 root root 853 Jul 15 2016 cautious-launcher
-rwxr-sr-x 1 root shadow 71816 Mar 22 2019 chage
lrwxrwxrwx 1 root root 11 Jun 18 2017 chardet3 -> chardetect3
-rwxr-xr-x 1 root root 389 Jun 18 2017 chardetect3
-rwxr-xr-x 1 root root 14336 Jan 22 08:40 chattr
-rwxr-xr-x 1 root root 63672 Jan 18 2018 chcon
-rwsr-xr-x 1 root root 76496 Mar 22 2019 chfn
-rwxr-xr-x 1 root root 30800 Mar 5 11:23 chrt
-rwsr-xr-x 1 root root 44528 Mar 22 2019 chsh
-rwxr-xr-x 1 root root 35000 Jan 18 2018 cksum
-rwxr-xr-x 1 root root 10240 May 23 2018 clear
-rwxr-xr-x 1 root root 10312 Jun 6 2019 clear_console
-rwxr-xr-x 1 root root 390 Jan 15 10:35 cloud-id
-rwxr-xr-x 1 root root 394 Jan 15 10:35 cloud-init
-rwxr-xr-x 1 root root 2108 Jan 14 14:27 cloud-init-per
-rwxr-xr-x 1 root root 47200 Aug 4 2017 cmp
-rwxr-xr-x 1 root root 39128 Jan 18 2018 comm
lrwxrwxrwx 1 root root 11 Jul 15 2016 compose -> run-mailcap
lrwxrwxrwx 1 root root 35 Aug 7 2018 console-conf -> ../share/subiquity/console-conf-tui
-rwxr-xr-x 1 root root 1565 Jul 7 05:45 core-sshd-host-keygen
-rwxr-xr-x 1 root root 6332 May 27 14:15 c_rehash
-rwxr-xr-x 1 root root 51416 Jan 18 2018 csplit
lrwxrwxrwx 1 root root 6 May 11 09:40 ctstat -> lnstat
-rwxr-xr-x 1 root root 43224 Jan 18 2018 cut
-rwxr-xr-x 1 root root 10224 Jun 11 13:25 dbus-cleanup-sockets
-rwxr-xr-x 1 root root 236584 Jun 11 13:25 dbus-daemon
-rwxr-xr-x 1 root root 22520 Jun 11 13:25 dbus-monitor
-rwxr-xr-x 1 root root 10224 Jun 11 13:25 dbus-run-session
-rwxr-xr-x 1 root root 26608 Jun 11 13:25 dbus-send
-rwxr-xr-x 1 root root 14320 Jun 11 13:25 dbus-update-activation-environment
-rwxr-xr-x 1 root root 10224 Jun 11 13:25 dbus-uuidgen
-rwxr-xr-x 1 root root 20142 Oct 25 2017 deb-systemd-helper
-rwxr-xr-x 1 root root 4434 Oct 25 2017 deb-systemd-invoke
-rwxr-xr-x 1 root root 22608 Mar 5 11:23 delpart
-rwxr-xr-x 1 root root 2550 Apr 1 2018 dh_bash-completion
-rwxr-xr-x 1 root root 145752 Aug 4 2017 diff
-rwxr-xr-x 1 root root 63704 Aug 4 2017 diff3
-rwxr-xr-x 1 root root 47296 Jan 18 2018 dircolors
-rwxr-xr-x 1 root root 30904 Jan 18 2018 dirname
-rwxr-xr-x 1 root root 153952 Sep 5 2019 dpkg-deb
-rwxr-xr-x 1 root root 100568 Jan 18 2018 du
-rwxr-xr-x 1 root root 7297 Apr 13 2018 ec2metadata
lrwxrwxrwx 1 root root 11 Jul 15 2016 edit -> run-mailcap
lrwxrwxrwx 1 root root 8 Jul 7 05:47 editor -> vim.tiny
-rwxr-xr-x 1 root root 35000 Jan 18 2018 env
lrwxrwxrwx 1 root root 8 Jul 7 05:47 ex -> vim.tiny
-rwxr-xr-x 1 root root 39128 Jan 18 2018 expand
-rwxr-sr-x 1 root shadow 22808 Mar 22 2019 expiry
-rwxr-xr-x 1 root root 47288 Jan 18 2018 expr
-rwxr-xr-x 1 root root 75992 Jan 18 2018 factor
-rwxr-xr-x 1 root root 18728 Mar 22 2019 faillog
-rwxr-xr-x 1 root root 26704 Mar 5 11:23 fallocate
-rwxr-xr-x 1 root root 238080 Nov 5 2017 find
-rwxr-xr-x 1 root root 30880 Mar 5 11:23 flock
-rwxr-xr-x 1 root root 43192 Jan 18 2018 fmt
-rwxr-xr-x 1 root root 35000 Jan 18 2018 fold
-rwxr-xr-x 1 root root 18512 Aug 9 2019 free
-rwxr-xr-x 1 root root 30856 Jun 4 12:25 getconf
-rwxr-xr-x 1 root root 31224 Jun 4 12:25 getent
-rwxr-xr-x 1 root root 14408 Mar 5 11:23 getopt
-rwsr-xr-x 1 root root 75824 Mar 22 2019 gpasswd
-rwxr-xr-x 1 root root 437264 Jan 10 2019 gpgv
-rwxr-xr-x 1 root root 35000 Jan 18 2018 groups
-rwxr-xr-x 1 root root 21883 Apr 13 2018 growpart
-rwxr-xr-x 1 root root 43224 Jan 18 2018 head
-rwxr-xr-x 1 root root 2514 Feb 2 2018 helpztags
-rwxr-xr-x 1 root root 30904 Jan 18 2018 hostid
-rwxr-xr-x 1 root root 18504 May 3 06:30 hostnamectl
lrwxrwxrwx 1 root root 7 Mar 5 11:23 i386 -> setarch
-rwxr-xr-x 1 root root 63744 Jun 4 12:25 iconv
-rwxr-xr-x 1 root root 43224 Jan 18 2018 id
-rwxr-xr-x 1 root root 59464 May 23 2018 infocmp
lrwxrwxrwx 1 root root 3 May 23 2018 infotocap -> tic
-rwxr-xr-x 1 root root 145664 Jan 18 2018 install
-rwxr-xr-x 1 root root 26704 Mar 5 11:23 ionice
-rwxr-xr-x 1 root root 26768 Mar 5 11:23 ipcmk
-rwxr-xr-x 1 root root 26704 Mar 5 11:23 ipcrm
-rwxr-xr-x 1 root root 51280 Mar 5 11:23 ipcs
lrwxrwxrwx 1 root root 19 Nov 11 2017 iptables-xml -> /sbin/xtables-multi
-rwxr-xr-x 1 root root 10280 Dec 30 2017 ischroot
-rwxr-xr-x 1 root root 47320 Jan 18 2018 join
lrwxrwxrwx 1 root root 16 Jul 7 05:47 jsondiff -> python3-jsondiff
lrwxrwxrwx 1 root root 17 Jul 7 05:47 jsonpatch -> python3-jsonpatch
lrwxrwxrwx 1 root root 19 Jul 7 05:47 jsonpointer -> python3-jsonpointer
lrwxrwxrwx 1 root root 18 Jul 7 05:47 jsonschema -> python3-jsonschema
-rwxr-xr-x 1 root root 4508 Jan 28 2018 kernel-install
-rwxr-xr-x 1 root root 43088 Mar 5 11:23 last
lrwxrwxrwx 1 root root 4 Mar 5 11:23 lastb -> last
-rwxr-xr-x 1 root root 18504 Mar 22 2019 lastlog
-rwxr-xr-x 1 root root 7786 Feb 25 2018 lcf
-rwxr-xr-x 1 root root 5422 Jun 4 12:25 ldd
lrwxrwxrwx 1 root root 9 Jul 7 05:46 less -> /bin/less
lrwxrwxrwx 1 root root 13 Jul 7 05:46 lessecho -> /bin/lessecho
lrwxrwxrwx 1 root root 13 Jul 7 05:46 lessfile -> /bin/lessfile
lrwxrwxrwx 1 root root 12 Jul 7 05:46 lesskey -> /bin/lesskey
lrwxrwxrwx 1 root root 13 Jul 7 05:46 lesspipe -> /bin/lesspipe
-rwxr-xr-x 1 root root 30904 Jan 18 2018 link
lrwxrwxrwx 1 root root 7 Mar 5 11:23 linux32 -> setarch
lrwxrwxrwx 1 root root 7 Mar 5 11:23 linux64 -> setarch
-rwxr-xr-x 1 root root 22888 May 11 09:40 lnstat
-rwxr-xr-x 1 root root 50592 Jun 4 12:25 locale
-rwxr-xr-x 1 root root 10240 Jan 30 06:28 locale-check
-rwxr-xr-x 1 root root 22600 May 3 06:30 localectl
-rwxr-xr-x 1 root root 338744 Jun 4 12:25 localedef
-rwxr-xr-x 1 root root 47792 Mar 5 11:23 logger
-rwxr-xr-x 1 root root 30904 Jan 18 2018 logname
-rwxr-xr-x 1 root root 10240 Jan 22 08:40 lsattr
-rwxr-xr-x 1 root root 71760 Mar 5 11:23 lscpu
-rwxr-xr-x 1 root root 71760 Mar 5 11:23 lsipc
-rwxr-xr-x 1 root root 35232 Mar 5 11:23 lslocks
-rwxr-xr-x 1 root root 63568 Mar 5 11:23 lslogins
-rwxr-xr-x 1 root root 43088 Mar 5 11:23 lsmem
-rwxr-xr-x 1 root root 38992 Mar 5 11:23 lsns
-rwxr-xr-x 1 root root 125416 Apr 3 2018 mawk
-rwxr-xr-x 1 root root 30864 Mar 5 11:23 mcookie
-rwxr-xr-x 1 root root 43224 Jan 18 2018 md5sum
lrwxrwxrwx 1 root root 6 Jan 18 2018 md5sum.textutils -> md5sum
-rwxr-xr-x 1 root root 10312 Mar 5 11:23 mesg
-rwxr-xr-x 1 root root 35098 Apr 9 2018 miniterm
-rwxr-xr-x 1 root root 63672 Jan 18 2018 mkfifo
-rwxr-xr-x 1 root root 189432 Jul 5 2018 mksquashfs
-rwxr-xr-x 1 root root 865 Jul 7 05:45 mkswapfile
-rwxr-xr-x 1 root root 26704 Mar 5 11:23 namei
lrwxrwxrwx 1 root root 4 Jul 7 05:47 nawk -> mawk
-rwsr-xr-x 1 root root 40344 Mar 22 2019 newgrp
-rwxr-xr-x 1 root root 35000 Jan 18 2018 nice
-rwxr-xr-x 1 root root 43288 Jan 18 2018 nl
-rwxr-xr-x 1 root root 35000 Jan 18 2018 nohup
-rwxr-xr-x 1 root root 35000 Jan 18 2018 nproc
-rwxr-xr-x 1 root root 31008 Mar 5 11:23 nsenter
-rwxr-xr-x 1 root root 26696 May 11 09:40 nstat
-rwxr-xr-x 1 root root 63736 Jan 18 2018 numfmt
-rwxr-xr-x 1 root root 67800 Jan 18 2018 od
-rwxr-xr-x 1 root root 723944 May 27 14:15 openssl
lrwxrwxrwx 1 root root 14 Jul 7 05:47 pager -> ../../bin/less
-rwxr-xr-x 1 root root 88144 Mar 5 11:23 partx
-rwsr-xr-x 1 root root 59640 Mar 22 2019 passwd
-rwxr-xr-x 1 root root 35032 Jan 18 2018 paste
-rwxr-xr-x 1 root root 35000 Jan 18 2018 pathchk
lrwxrwxrwx 1 root root 6 Oct 25 2018 pdb3 -> pdb3.6
lrwxrwxrwx 1 root root 23 Apr 17 20:56 pdb3.6 -> ../lib/python3.6/pdb.py
-rwxr-xr-x 2 root root 2097720 Nov 19 2018 perl
-rwxr-xr-x 2 root root 2097720 Nov 19 2018 perl5.26.1
-rwxr-xr-x 1 root root 26712 Aug 9 2019 pgrep
-rwxr-xr-x 1 root root 39128 Jan 18 2018 pinky
lrwxrwxrwx 1 root root 5 Aug 9 2019 pkill -> pgrep
-rwxr-xr-x 1 root root 18656 Jun 4 12:25 pldd
-rwxr-xr-x 1 root root 30808 Aug 9 2019 pmap
-rwxr-xr-x 1 root root 71960 Jan 18 2018 pr
lrwxrwxrwx 1 root root 11 Jul 15 2016 print -> run-mailcap
-rwxr-xr-x 1 root root 30904 Jan 18 2018 printenv
-rwxr-xr-x 1 root root 51384 Jan 18 2018 printf
-rwxr-xr-x 1 root root 35424 Mar 5 11:23 prlimit
lrwxrwxrwx 1 root root 28 Oct 15 2018 probert -> ../share/probert/bin/probert
-rwxr-xr-x 1 root root 71928 Jan 18 2018 ptx
-rwxr-xr-x 1 root root 10312 Aug 9 2019 pwdx
-rwxr-xr-x 1 root root 7812 Oct 25 2018 py3clean
-rwxr-xr-x 1 root root 12119 Oct 25 2018 py3compile
lrwxrwxrwx 1 root root 31 Oct 25 2018 py3versions -> ../share/python3/py3versions.py
lrwxrwxrwx 1 root root 8 Oct 25 2018 pydoc3 -> pydoc3.6
-rwxr-xr-x 1 root root 79 Apr 17 20:56 pydoc3.6
lrwxrwxrwx 1 root root 12 Oct 25 2018 pygettext3 -> pygettext3.6
-rwxr-xr-x 1 root root 21547 Apr 17 20:56 pygettext3.6
-rwxr-xr-x 1 root root 372 Sep 25 2017 pyjwt3
lrwxrwxrwx 1 root root 9 Oct 25 2018 python3 -> python3.6
-rwxr-xr-x 2 root root 4526456 Apr 17 20:56 python3.6
-rwxr-xr-x 2 root root 4526456 Apr 17 20:56 python3.6m
-rwxr-xr-x 1 root root 1018 Oct 28 2017 python3-jsondiff
-rwxr-xr-x 1 root root 3661 Oct 28 2017 python3-jsonpatch
-rwxr-xr-x 1 root root 1342 May 1 2016 python3-jsonpointer
-rwxr-xr-x 1 root root 398 Nov 15 2017 python3-jsonschema
lrwxrwxrwx 1 root root 10 Oct 25 2018 python3m -> python3.6m
lrwxrwxrwx 1 root root 3 Jul 7 05:47 rcp -> scp
-rwxr-xr-x 1 root root 26696 May 11 09:40 rdma
-rwxr-xr-x 1 root root 47320 Jan 18 2018 realpath
-rwxr-xr-x 1 root root 14408 Mar 5 11:23 rename.ul
-rwxr-xr-x 1 root root 14408 Mar 5 11:23 renice
lrwxrwxrwx 1 root root 4 May 23 2018 reset -> tset
-rwxr-xr-x 1 root root 38992 Mar 5 11:23 resizepart
-rwxr-xr-x 1 root root 10312 Mar 5 11:23 rev
-rwxr-xr-x 1 root root 30 Jul 11 2017 rgrep
lrwxrwxrwx 1 root root 3 Jul 7 05:47 rlogin -> ssh
-rwxr-xr-x 1 root root 208 May 11 09:40 routef
-rwxr-xr-x 1 root root 1656 May 11 09:40 routel
lrwxrwxrwx 1 root root 3 Jul 7 05:47 rsh -> ssh
lrwxrwxrwx 1 root root 6 May 11 09:40 rtstat -> lnstat
-rwxr-xr-x 1 root root 35000 Jan 18 2018 runcon
-rwxr-xr-x 1 root root 18161 Jul 15 2016 run-mailcap
lrwxrwxrwx 1 root root 8 Jul 7 05:47 rview -> vim.tiny
-rwxr-xr-x 1 root root 10469 Dec 30 2017 savelog
-rwxr-xr-x 1 root root 100496 Mar 4 2019 scp
-rwxr-xr-x 1 root root 30792 Mar 5 11:23 script
-rwxr-xr-x 1 root root 26704 Mar 5 11:23 scriptreplay
-rwxr-xr-x 1 root root 51296 Aug 4 2017 sdiff
lrwxrwxrwx 1 root root 11 Jul 15 2016 see -> run-mailcap
-rwxr-xr-x 1 root root 2442 Mar 12 2018 select-editor
-rwxr-xr-x 1 root root 1209 Mar 12 2018 sensible-browser
-rwxr-xr-x 1 root root 1109 Mar 12 2018 sensible-editor
-rwxr-xr-x 1 root root 433 Mar 12 2018 sensible-pager
-rwxr-xr-x 1 root root 47288 Jan 18 2018 seq
-rwxr-xr-x 1 root root 18784 Mar 5 11:23 setarch
-rwxr-xr-x 1 root root 10312 Mar 5 11:23 setsid
-rwxr-xr-x 1 root root 43088 Mar 5 11:23 setterm
-rwxr-xr-x 1 root root 153960 Mar 4 2019 sftp
lrwxrwxrwx 1 root root 6 Mar 22 2019 sg -> newgrp
-rwxr-xr-x 1 root root 47320 Jan 18 2018 sha1sum
-rwxr-xr-x 1 root root 55512 Jan 18 2018 sha224sum
-rwxr-xr-x 1 root root 55512 Jan 18 2018 sha256sum
-rwxr-xr-x 1 root root 59608 Jan 18 2018 sha384sum
-rwxr-xr-x 1 root root 59608 Jan 18 2018 sha512sum
-rwxr-xr-x 1 root root 59608 Jan 18 2018 shred
-rwxr-xr-x 1 root root 55480 Jan 18 2018 shuf
-rwxr-xr-x 1 root root 26704 Aug 9 2019 skill
-rwxr-xr-x 1 root root 18512 Aug 9 2019 slabtop
lrwxrwxrwx 1 root root 3 Mar 4 2019 slogin -> ssh
lrwxrwxrwx 1 root root 32 Jul 7 05:47 snap -> /snap/snapd/current/usr/bin/snap
lrwxrwxrwx 1 root root 20 Jul 7 05:47 snapctl -> ../lib/snapd/snapctl
lrwxrwxrwx 1 root root 5 Aug 9 2019 snice -> skill
-rwxr-xr-x 1 root root 113120 Jan 18 2018 sort
-rwxr-xr-x 1 root root 55936 Jan 18 2018 split
-rwxr-xr-x 1 root root 727848 Mar 4 2019 ssh
-rwxr-xr-x 1 root root 346248 Mar 4 2019 ssh-add
-rwxr-sr-x 1 root crontab 362640 Mar 4 2019 ssh-agent
-rwxr-xr-x 1 root root 1456 Jan 16 2018 ssh-argv0
-rwxr-xr-x 1 root root 10658 Oct 2 2017 ssh-copy-id
-rwxr-xr-x 1 root root 420000 Mar 4 2019 ssh-keygen
-rwxr-xr-x 1 root root 420000 Mar 4 2019 ssh-keyscan
-rwxr-xr-x 1 root root 80088 Jan 18 2018 stat
-rwxr-xr-x 1 root root 47288 Jan 18 2018 stdbuf
-rwsr-xr-x 1 root root 149080 Jan 31 11:18 sudo
lrwxrwxrwx 1 root root 4 Jan 31 11:18 sudoedit -> sudo
-rwxr-xr-x 1 root root 56128 Jan 31 11:18 sudoreplay
-rwxr-xr-x 1 root root 39104 Jan 18 2018 sum
-rwxr-xr-x 1 root root 1558792 May 3 06:30 systemd-analyze
-rwxr-xr-x 1 root root 10312 May 3 06:30 systemd-cat
-rwxr-xr-x 1 root root 14408 May 3 06:30 systemd-cgls
-rwxr-xr-x 1 root root 30816 May 3 06:30 systemd-cgtop
-rwxr-xr-x 1 root root 22600 May 3 06:30 systemd-delta
-rwxr-xr-x 1 root root 10304 May 3 06:30 systemd-detect-virt
-rwxr-xr-x 1 root root 43104 May 3 06:30 systemd-mount
-rwxr-xr-x 1 root root 10304 May 3 06:30 systemd-path
-rwxr-xr-x 1 root root 88136 May 3 06:30 systemd-resolve
-rwxr-xr-x 1 root root 43080 May 3 06:30 systemd-run
-rwxr-xr-x 1 root root 18504 May 3 06:30 systemd-socket-activate
-rwxr-xr-x 1 root root 14408 May 3 06:30 systemd-stdio-bridge
lrwxrwxrwx 1 root root 13 May 3 06:30 systemd-umount -> systemd-mount
-rwxr-xr-x 1 root root 14328 May 23 2018 tabs
-rwxr-xr-x 1 root root 39096 Jan 18 2018 tac
-rwxr-xr-x 1 root root 67832 Jan 18 2018 tail
-rwxr-xr-x 1 root root 30800 Mar 5 11:23 taskset
-rwxr-xr-x 1 root root 35032 Jan 18 2018 tee
-rwxr-xr-x 1 root root 47288 Jan 18 2018 test
-rwxr-xr-x 1 root root 84080 May 23 2018 tic
-rwxr-xr-x 1 root root 815 Jul 7 05:47 timedatectl
-rwxr-xr-x 1 root root 22600 May 3 06:30 timedatectl.real
-rwxr-xr-x 1 root root 39552 Jan 18 2018 timeout
-rwxr-xr-x 1 root root 14424 Aug 9 2019 tload
-rwxr-xr-x 1 root root 14328 May 23 2018 toe
-rwxr-xr-x 1 root root 108304 Aug 9 2019 top
lrwxrwxrwx 1 root root 10 Jul 6 23:54 touch -> /bin/touch
-rwxr-xr-x 1 root root 18456 May 23 2018 tput
-rwxr-xr-x 1 root root 47288 Jan 18 2018 tr
-rwxr-xr-x 1 root root 39096 Jan 18 2018 truncate
-rwxr-xr-x 1 root root 22528 May 23 2018 tset
-rwxr-xr-x 1 root root 35000 Jan 18 2018 tsort
-rwxr-xr-x 1 root root 30904 Jan 18 2018 tty
-rwxr-xr-x 1 root root 15397 Jun 4 12:25 tzselect
-rwxr-xr-x 1 root root 40685 Feb 25 2018 ucf
-rwxr-xr-x 1 root root 19367 Feb 25 2018 ucfq
-rwxr-xr-x 1 root root 10722 Feb 25 2018 ucfr
-rwxr-xr-x 1 root root 39128 Jan 18 2018 unexpand
-rwxr-xr-x 1 root root 43224 Jan 18 2018 uniq
-rwxr-xr-x 1 root root 30904 Jan 18 2018 unlink
-rwxr-xr-x 1 root root 18712 Mar 5 11:23 unshare
-rwxr-xr-x 1 root root 98008 Jul 5 2018 unsquashfs
-rwxr-xr-x 1 root root 47112 Sep 5 2019 update-alternatives
-rwxr-xr-x 1 root root 10312 Aug 9 2019 uptime
-rwxr-xr-x 1 root root 35000 Jan 18 2018 users
-rwxr-xr-x 1 root root 22600 Mar 5 11:23 utmpdump
-rwxr-xr-x 1 root root 6913 Apr 13 2018 vcs-run
lrwxrwxrwx 1 root root 8 Jul 7 05:47 vi -> vim.tiny
lrwxrwxrwx 1 root root 8 Jul 7 05:47 view -> vim.tiny
-rwxr-xr-x 1 root root 1108024 Mar 18 13:29 vim.tiny
-rwxr-xr-x 1 root root 34912 Aug 9 2019 vmstat
lrwxrwxrwx 1 root root 8 Jul 7 05:47 w -> w.procps
-rwxr-sr-x 1 root tty 30800 Mar 5 11:23 wall
-rwxr-xr-x 1 root root 22952 Aug 9 2019 watch
-rwxr-xr-x 1 root root 43200 Jan 18 2018 wc
-rwxr-xr-x 1 root root 27144 Mar 5 11:23 whereis
lrwxrwxrwx 1 root root 10 Jul 6 23:54 which -> /bin/which
-rwxr-xr-x 1 root root 51416 Jan 18 2018 who
-rwxr-xr-x 1 root root 30904 Jan 18 2018 whoami
-rwxr-xr-x 1 root root 63488 Sep 17 2019 wpa_passphrase
-rwxr-xr-x 1 root root 18504 Aug 9 2019 w.procps
lrwxrwxrwx 1 root root 7 Mar 5 11:23 x86_64 -> setarch
-rwxr-xr-x 1 root root 71896 Nov 5 2017 xargs
-rwxr-xr-x 1 root root 38 Jul 7 05:47 xdg-open
-rwxr-xr-x 1 root root 886 Jul 7 05:47 xdg-settings
-rwxr-xr-x 1 root root 18552 Mar 18 13:29 xxd
-rwxr-xr-x 1 root root 30904 Jan 18 2018 yes
-rwxr-xr-x 1 root root 18488 Jun 4 12:25 zdump
A snippet of the results from running it in a command line window (includes yarn, npm, and node):
// The rest is cut off
lrwxrwxrwx 1 root root 21 Apr 29 12:37 rcp -> /etc/alternatives/rcp
-rwxr-xr-x 1 root root 149096 Apr 3 01:47 rctest
-rwxr-xr-x 1 root root 9112 Mar 26 04:23 rdiffdir
-rwxr-xr-x 1 root root 133360 Feb 13 11:21 rdma
lrwxrwxrwx 1 root root 24 Apr 29 12:37 readelf -> x86_64-linux-gnu-readelf
-rwxr-xr-x 1 root root 51544 Sep 5 2019 readlink
-rwxr-xr-x 1 root root 51576 Sep 5 2019 realpath
-rwxr-xr-x 1 root root 14568 Mar 22 10:42 recode-sr-latin
-rwxr-xr-x 1 root root 3445 Oct 23 2016 recountdiff
-rwxr-xr-x 1 root root 89 Feb 22 00:20 red
-rwxr-xr-x 1 root root 34928 Oct 23 2016 rediff
...
...
...
-rwxr-xr-x 1 root root 40360 Mar 18 2018 xvidtune
-rwxr-xr-x 1 root root 18744 Feb 29 00:29 xvinfo
-rwxr-xr-x 1 root root 39232 Feb 28 17:10 xwd
lrwxrwxrwx 1 root root 34 Apr 29 12:37 x-window-manager -> /etc/alternatives/x-window-manager
-rwxr-xr-x 1 root root 51592 Feb 29 00:29 xwininfo
-rwxr-xr-x 1 root root 35120 Feb 28 17:10 xwud
lrwxrwxrwx 1 root root 31 Apr 29 12:37 x-www-browser -> /etc/alternatives/x-www-browser
-rwxr-xr-x 1 root root 18712 Apr 15 01:40 xxd
-rwxr-xr-x 1 root root 80224 Jan 27 2019 xz
lrwxrwxrwx 1 root root 2 Apr 29 12:37 xzcat -> xz
lrwxrwxrwx 1 root root 6 Apr 29 12:37 xzcmp -> xzdiff
-rwxr-xr-x 1 root root 6632 Jan 27 2019 xzdiff
lrwxrwxrwx 1 root root 6 Apr 29 12:37 xzegrep -> xzgrep
lrwxrwxrwx 1 root root 6 Apr 29 12:37 xzfgrep -> xzgrep
-rwxr-xr-x 1 root root 5628 Jan 27 2019 xzgrep
-rwxr-xr-x 1 root root 1802 Jan 27 2019 xzless
-rwxr-xr-x 1 root root 2161 Jan 27 2019 xzmore
lrwxrwxrwx 1 root root 22 Mar 9 10:51 yarn -> ../share/yarn/bin/yarn
lrwxrwxrwx 1 root root 22 Mar 9 10:51 yarnpkg -> ../share/yarn/bin/yarn
-rwxr-xr-x 1 root root 63720 Apr 7 15:15 yelp
-rwxr-xr-x 1 root root 39256 Sep 5 2019 yes
-rwxr-xr-x 1 root root 409 Apr 10 08:47 youtube-dl
lrwxrwxrwx 1 root root 8 Apr 29 12:37 ypdomainname -> hostname
-rwxr-xr-x 1 root root 1984 Dec 13 2019 zcat
-rwxr-xr-x 1 root root 1678 Dec 13 2019 zcmp
-rwxr-xr-x 1 root root 5880 Dec 13 2019 zdiff
-rwxr-xr-x 1 root root 26840 Apr 14 14:26 zdump
-rwxr-xr-x 1 root root 29 Dec 13 2019 zegrep
-rwxr-xr-x 1 root root 135960 Feb 27 03:31 zenity
-rwxr-xr-x 1 root root 29 Dec 13 2019 zfgrep
-rwxr-xr-x 1 root root 2081 Dec 13 2019 zforce
-rwxr-xr-x 1 root root 7585 Dec 13 2019 zgrep
-rwxr-xr-x 1 root root 216256 Apr 21 2017 zip
-rwxr-xr-x 1 root root 93816 Apr 21 2017 zipcloak
-rwxr-xr-x 1 root root 50718 Mar 6 15:15 zipdetails
-rwxr-xr-x 1 root root 2953 Aug 16 2019 zipgrep
-rwxr-xr-x 1 root root 186664 Aug 16 2019 zipinfo
-rwxr-xr-x 1 root root 89488 Apr 21 2017 zipnote
-rwxr-xr-x 1 root root 93584 Apr 21 2017 zipsplit
-rwxr-xr-x 1 root root 26952 Jan 30 14:30 zjsdecode
-rwxr-xr-x 1 root root 2206 Dec 13 2019 zless
-rwxr-xr-x 1 root root 1842 Dec 13 2019 zmore
-rwxr-xr-x 1 root root 4553 Dec 13 2019 znew
So for some reason the contents of /usr/bin is different when accessed from my distros command line v. the spawned script (1745 v. 317 lines printed when adding | wc -l). Why is this the case? I can't think of any reason that would cause this behavior, and the child process docs haven't shed any additional light.
I'm getting myself familiar with Linux (Debian 9). However I managed to get myself confused with the ls command manual. I made up the following trivial setting for testing:
meouser:~/triv_dir$ ls -laR
.:
total 24
drwxr-xr-x 4 meouser meouser 4096 Mar 27 15:42 .
drwxr-xr-x 19 meouser meouser 4096 Mar 27 15:41 ..
drwxr-xr-x 4 meouser meouser 4096 Mar 27 15:55 a
drwxr-xr-x 2 meouser meouser 4096 Mar 27 15:42 b
-rw-r--r-- 1 meouser meouser 6 Mar 27 15:44 c
-rw-r--r-- 1 meouser meouser 6 Mar 27 15:44 d
./a:
total 24
drwxr-xr-x 4 meouser meouser 4096 Mar 27 15:55 .
drwxr-xr-x 4 meouser meouser 4096 Mar 27 15:42 ..
-rw-r--r-- 1 meouser meouser 4 Mar 27 15:50 aa
-rw-r--r-- 1 meouser meouser 4 Mar 27 15:50 ab
drwxr-xr-x 2 meouser meouser 4096 Mar 27 15:55 a_sub_1
drwxr-xr-x 2 meouser meouser 4096 Mar 27 15:55 a_sub_2
./a/a_sub_1:
total 12
drwxr-xr-x 2 meouser meouser 4096 Mar 27 15:55 .
drwxr-xr-x 4 meouser meouser 4096 Mar 27 15:55 ..
-rw-r--r-- 1 meouser meouser 4 Mar 27 15:55 aaa
./a/a_sub_2:
total 8
drwxr-xr-x 2 meouser meouser 4096 Mar 27 15:55 .
drwxr-xr-x 4 meouser meouser 4096 Mar 27 15:55 ..
./b:
total 16
drwxr-xr-x 2 meouser meouser 4096 Mar 27 15:42 .
drwxr-xr-x 4 meouser meouser 4096 Mar 27 15:42 ..
-rw-r--r-- 1 meouser meouser 4 Mar 27 15:50 ba
-rw-r--r-- 1 meouser meouser 4 Mar 27 15:50 bb
I would like to see all the directory names and their subdirectories, but not the filenames. That is, I want something like ls --insert-options-here so that the output is this subset from above:
.:
total 24
drwxr-xr-x 4 meouser meouser 4096 Mar 27 15:42 .
drwxr-xr-x 19 meouser meouser 4096 Mar 27 15:41 ..
drwxr-xr-x 4 meouser meouser 4096 Mar 27 15:55 a
drwxr-xr-x 2 meouser meouser 4096 Mar 27 15:42 b
./a:
total 24
drwxr-xr-x 4 meouser meouser 4096 Mar 27 15:55 .
drwxr-xr-x 4 meouser meouser 4096 Mar 27 15:42 ..
drwxr-xr-x 2 meouser meouser 4096 Mar 27 15:55 a_sub_1
drwxr-xr-x 2 meouser meouser 4096 Mar 27 15:55 a_sub_2
According to ls manual that should be achieved by ls -ldR.
meouser:~/triv_dir$ man ls
-a, --all
do not ignore entries starting with .
-d, --directory
list directories themselves, not their contents
-l use a long listing format
-R, --recursive
list subdirectories recursively
But this is what happens instead: only the '.' is shown.
meouser:~/triv_dir$ ls -ldR
drwxr-xr-x 4 meouser meouser 4096 Mar 27 15:42 .
What am I missing from the manual?
I noticed from https://stackoverflow.com/a/29277454/11199684 that this can be achieved by
find . -maxdepth 2 -type d -print
which is impressive but it gives less information than the ls output above. Besides, I might not know beforehand the correct maxdepth? And above all, for future needs I'm actually interested in teaching myself from the manuals. Advice are appreciated.
The -d option apply to [FILE] given as input, in your case, as none are given, you fall back to the default one : the current directory. The recursivity doesn't apply as no directory are returned.
To get the same output as ls with the find command, you can combine them :
find . -type d -exec ls -ld {} \;
in some way you could use the grep tool to filter the results:
ll -A | grep ^d
if you want to use it programatically, in a bash script you can have only the dir names (but find might be better for that):
ll -A | grep / | awk '{print $9}'
This command doesn't behave as I would expect. -atime +1 says "anything accessed within the last 24 hours", correct?
Output:
find . -type f -atime +1 -name 'installActions2*.log' | xargs ls -lt
-rw-r----- 1 bordb oinstall 369657 Nov 15 19:41 ./oms_b4_18604893.bak.15_Nov_14/cfgtoollogs/oui/installActions2014-03-17_09-18-01-PM.log
-rw-r----- 1 andy oinstall 1749422 Mar 17 2014 ./oracle_common/cfgtoollogs/oui/installActions2014-03-17_09-25-00-PM.log
-rw-r----- 1 andy oinstall 369657 Mar 17 2014 ./oms/cfgtoollogs/oui/installActions2014-03-17_09-18-01-PM.log
-rw-r----- 1 andy oinstall 600584 Mar 17 2014 ./jdk16/cfgtoollogs/oui/installActions2014-03-17_06-18-27PM.log
why are the files from March of 2014 and November showing up? So assuming the -atime switch says, "modified earier than the last 24 hours", I changed it to 60, and it lists the current directory, and all its files (ignores the -name switch) and doesn't traverse the subdirectories.
/ora/oracle/product/middleware_12cr3 Unix> find . -type f -atime +60 -name 'installActions2*.log' | xargs ls -lt
total 204
drwxr-xr-x 53 andy oinstall 4096 Jan 8 00:05 oms
drwxr-x--- 51 andy oinstall 4096 Jan 8 00:05 Oracle_WT
drwxr-x--- 33 andy oinstall 4096 Jan 7 22:09 oracle_common
drwxr-xr-x 2 andy oinstall 4096 Nov 20 07:45 logs
drwxr-xr-x 52 andy oinstall 4096 Nov 15 19:44 oms_b4_18604893.bak.15_Nov_14
drwxr-xr-x 10 andy oinstall 4096 Jun 18 2014 plugins
drwxr-xr-x 9 andy oinstall 4096 Jun 2 2014 wlserver_10.3
-rw-rw---- 1 andy oinstall 520 Mar 18 2014 domain-registry.xml
drwxr-x--- 3 andy oinstall 4096 Mar 18 2014 user_projects
drwxr-xr-x 5 andy oinstall 4096 Mar 17 2014 patch_wls1036
-rw-r--r-- 1 andy oinstall 1826 Mar 17 2014 registry.xml
-rw-r--r-- 1 andy oinstall 622 Mar 17 2014 ocm.rsp
-rw-r--r-- 1 andy oinstall 108917 Mar 17 2014 registry.dat
drwxr-xr-x 8 andy oinstall 4096 Mar 17 2014 utils
drwxr-xr-x 7 andy oinstall 36864 Mar 17 2014 modules
drwxr-xr-x 6 andy oinstall 4096 Mar 17 2014 jdk16
anyone know the reason? Sorry if this not an advanced question.
The -*time args to find consider time as growing larger in the past. So +1 means "more than one day ago", not "after one day ago". Try -1 to mean "less than one day ago".
bash-3.2$ ls -ls
total 48
4 -rw-r--r-- 1 hdoostie etrade 1545 Aug 8 2012 ~
4 drwxr-xr-- 11 hdoostie etrade 4096 Dec 28 2011 det-us
4 drwxr-xr-- 6 hdoostie etrade 4096 Sep 18 2012 etaf
12 -rw-r--r-- 1 hdoostie etrade 11867 Jul 31 2012 l:template name="expanded_search">
4 drwxr-xr-- 8 hdoostie etrade 4096 Apr 22 11:31 neo
4 drwxr-xr-- 5 hdoostie etrade 4096 Jan 29 14:36 neo-apps-skins
4 drwxr-xr-- 5 hdoostie etrade 4096 Feb 16 2012 neo-webapp-prospect
4 drwxr-xr-- 3 hdoostie etrade 4096 Feb 22 2012 site_04_uat_in_here
4 drwxr-xr-- 3 hdoostie etrade 4096 Jun 20 2012 svntest
4 drwxr-xr-- 3 hdoostie etrade 4096 Feb 23 2012 xborder_in_here
"l:template name="expanded_search">" is some file content that somehow shows as a file. How do I "delete" this "file"?
A way of deleting any file, no matter what characters the filename contains is using it's inode numnber. You can show that using:
ls -i
That will shou you the files with the inode number next to them. Then you can delete that file using:
find -ium [inode_number] -exec rm {} \;
But in this case it should also be enough to just quote the filename:
rm 'l:template name="expanded_search">'
rm l:*
If you're the cautious type:
rm -i l:*