Tag Info

Hot answers tagged


Using grep + wc (this will cater for multiple occurences of the term on the same line): grep -rFo foo | wc -l -r in grep: searches recursively in the current directory hierarchy; -F in grep: matches against a fixed string instead of against a pattern; -o in grep: prints only matches; -l in wc: prints the count of the lines; % tree . ...


grep -Rc [term] * will do that. The -R flag means you want to recursively search the current directory and all of its subdirectories. The * is a file selector meaning: all files. The -c flag makes grep output only the number of occurrences. However, if the word occurs multiple times on a single line, it is counted only once. From man grep: -r, ...


In a small python script: #!/usr/bin/env python3 import os import sys s = sys.argv[1] n = 0 for root, dirs, files in os.walk(os.getcwd()): for f in files: f = root+"/"+f try: n = n + open(f).read().count(s) except: pass print(n) Save it as count_string.py. Run it from the directory with the ...


From chown --help: Usage: chown [OPTION]... [OWNER][:[GROUP]] FILE... or: chown [OPTION]... --reference=RFILE FILE... Change the owner and/or group of each FILE to OWNER and/or GROUP. [...] -R, --recursive operate on files and directories recursively [...] So you need to run (probably with sudo): chown -R USERNAME:GROUPNAME /PATH/TO/FILE ...


You need to create the directory tree from subdir1/subdir2/ - mv won't do that for you. You could do, for example: find . -type f -mtime +5 -print0 | while IFS= read -r -d '' file; do dir="${file%/*}" mkdir -p ../rootarchive/"$dir" mv "$file" ../rootarchive/"$file" done You could rsync. It can recreate the directory structure and do deleting ...


chown -R <name>:<name> <folder> This is how I normally do it, and I usually do this one folder at a time. Doesn't take but a few moments to work through each folder.


Yes, it is a path but not regular one. It's in Dconf databases (either user one or system common one) $ file ~/.config/dconf/user /home/user/.config/dconf/user: GVariant Database file, version 0 $ file /etc/dconf/db/gdm /etc/dconf/db/gdm: GVariant Database file, version 0 You may use dconf-editor which is GUI tool to manipulate user dconf setting. See ...


As a variant of @kos's nice answer, if you are interested in itemizing the counts, you can use grep's -c switch to count occurrences: $ grep -rFoc foo file1:3 dir/file2:3


There are no permission settings that can do this, even using ACLs, but you can have a race with the program, using inotifywait: In one terminal, I ran: while sleep 0.5; do if mkdir foo/bar; then echo foo; rmdir foo/bar; fi; done As you can see, this creates a directory, echoes a message and removes the directory - all of which happens very quickly by ...


Go to your download files with this command: $ cd ~/Downloads Then run this command to copy the file to the /opt directory: $ sudo cp john-1.7.9.tar.gz /opt/ By the way, you are most likely getting the error file not found error message because you don't have a downloads directory. You have a Downloads directory. The files and directory names in ...


You can use Back In Time to create snapshots. All snapshots (and also the live filesystem) can be compared by selecting the file/folder you are interested in and using View > Snapshots. Select the second snapshot to compare and press Diff. This will open a Side by Side view (using Meld) of both snapshots/live fs. I'm member of BIT Dev-Team


If you want to the output of the terminal to a file that is stored in your Temp folder, then type: your command > /path/to/Temp/anyname.txt


This is not a filesystem path but a dconf path. It specifies a directory within the dconf database and is not related to any file or directory in your file system.


I can do it simply: cp -r path/to/original/dir1 path/to/original/newdir1 i.e: i have no directory_A1 already created but directory_A in home/me/Documents: cp -r /home/me/Documents/directory_A /home/me/Documents/directory_A1 if tou want 'directory_A(1)': cp -r /home/me/Documents/directory_A "/home/me/Documents/directory_A(1)"

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