nl
stringlengths
13
387
bash
stringlengths
1
532
Archive showing progress "sourcefolder" to "/destinationfolder" excluding "thefoldertoexclude"
rsync -av --progress sourcefolder /destinationfolder --exclude thefoldertoexclude
Archive showing progress all files in "/media/2TB\ Data/data/music/" to "/media/wd/network_sync/music/" excluding files matching "*.VOB", "*.avi", "*.mkv", "*.ts", "*.mpg", "*.iso", "*ar", "*.vob", "*.BUP", "*.cdi", "*.ISO", "*.shn", "*.MPG", "*.AVI", "*.DAT", "*.img", "*.nrg", "*.cdr", "*.bin", "*.MOV", "*.goutputs*", "*.flv", "*.mov", "*.m2ts", "*.cdg", "*.IFO", "*.asf", and "*.ite"
rsync -av --progress --exclude=*.VOB --exclude=*.avi --exclude=*.mkv --exclude=*.ts --exclude=*.mpg --exclude=*.iso --exclude=*ar --exclude=*.vob --exclude=*.BUP --exclude=*.cdi --exclude=*.ISO --exclude=*.shn --exclude=*.MPG --exclude=*.AVI --exclude=*.DAT --exclude=*.img --exclude=*.nrg --exclude=*.cdr --exclude=*.bin --exclude=*.MOV --exclude=*.goutputs* --exclude=*.flv --exclude=*.mov --exclude=*.m2ts --exclude=*.cdg --exclude=*.IFO --exclude=*.asf --exclude=*.ite /media/2TB\ Data/data/music/* /media/wd/network_sync/music/
As root, edit the cron job list of user "apache" using the editor specified by EDITOR environment variable, or default /usr/bin/editor if this variable is not set.
sudo crontab -e -u apache
as root, find from / all files called "file.txt"
sudo find / -name file.txt
ask user confirmation and delete all the files in the directory /mydir which have not been accessed in the last 100*24 hours
find /mydir -atime +100 -ok rm {} \;
Assign permissions 644 to files in the current directory tree
find . -type f -print0 | xargs -0 chmod 644
Assign permissions 755 to directories in the current directory tree
find . -type d -print0 | xargs -0 chmod 755
Attempt to connect as root to localhost and copy /home/reportuser/dailyReport.doc to directory /root/dailyReports/20150105/ - this will normally fail because ssh won't accept root connections by default.
scp -p /home/reportuser/dailyReport.doc root@localhost:/root/dailyReports/20150105/
Attempt to connect as root via ssh to host "IP" and copy /root/K to local machine, passing option "StrictHostKeyChecking=no" to the ssh backend - this will normally fail because ssh servers by default don't (and shouldn't) accept root logins.
scp -o StrictHostKeyChecking=no root@IP:/root/K
Back up all *.txt files/directories in new files/directories with a .bak extension in their names under /etc directory
find /etc -name "*.txt" | xargs -I {} mv {} {}.bak
Back up all *.txt files/directories in new files/directories with a .bak extension in their names under /etc directory
find /etc -print0 -name "*.txt" | xargs -I {} -0 mv {} {}.bak
Backup all of the Java files in the current directory tree by copying them and appending the suffix .bk to each
find . -name "*.java" -exec cp {} {}.bk \;
bind key "\x61" to insert itself
bind $'"\x61"':self-insert
bind word "foobar" to key code "\e[24~"
bind '"\e[24~":"foobar"'
Build an "svn hotcopy" command for each subdirectory of /usr/local/svn/repos/
find /usr/local/svn/repos/ -maxdepth 1 -mindepth 1 -type d -printf "%f\0" | xargs -0 -I{} echo svnadmin hotcopy /usr/local/svn/repos/\{\} /usr/local/backup/\{\}
Calculate and show md5 sums for every files under current directory tree
find . -type f -exec md5sum \{\} \;
Calculate and show md5 sums for every files under current directory tree
find . | xargs md5sum
calculate the disk usage for all the files which have been modified in the last 24 hours in ~/tmp folder and display the file sizes
find ~/tmp -mtime 0 -exec du -ks {} \; | cut -f1
Calculate md5 checksum of $line and save to variable 'md5'
md5=$(echo "$line"|md5sum)
Calculate md5 checksum of '/etc/localtime' and save the first space separated part in variable 'checksum'
checksum=`md5sum /etc/localtime | cut -d' ' -f1`
Calculate the md5 checksum of the current directory structure and save it in variable SUM
SUM=$(tree | md5sum)
Calculate md5 checksum of the list of all files/dirs in /path recursively including dot files and excluding the patterns 'run', 'sys', 'tmp' and 'proc', then check the checksum against the checksum saved in /tmp/file
ls -alR -I dev -I run -I sys -I tmp -I proc /path | md5sum -c /tmp/file
Calculate md5 checksum of theDirname
cpio -i -e theDirname | md5sum
Calculate md5 sums for each files matching 'main.cpp*'
md5sum main.cpp*
Calculate the md5 sum of "a"
echo "a" | md5sum
Calculate the md5 sum of "exampleString"
echo -n 'exampleString' | md5sum
Calculate the md5 sum of "password"
echo "password" | md5sum
Calculate the md5 sum of "yourstring"
echo -n "yourstring" |md5sum
Calculate the md5 sum of all ".py" files in "/your/dir" including content and filenames
grep -ar -e . --include="*.py" /your/dir | md5sum | cut -c-32
Calculate the md5 sum of all *.py files in the current directory
cat *.py | md5sum
Calculate the md5 sum of all files in "/your/dir" including content and filenames and following symbolic links
grep -aR -e . /your/dir | md5sum | cut -c-32
Calculate the md5 sum of all the file metadata in the current directory tree excluding ".svn"
find . -name '.svn' -prune -o -type f -printf '%m%c%p' | md5sum
Calculate the md5 sum of the contents of "$FILES"
cat $FILES | md5sum
Calculate the md5 sum of the contents of all files sorted in directory tree "/path"
find /path -type f | sort -u | xargs cat | md5sum
Calculate the md5 sum of every ".py" file in directory tree "/path"
find /path -type f -name "*.py" -exec md5sum "{}" +;
Calculate the md5 sum of the file "filename" and print only the hash
md5sum filename |cut -f 1 -d " "
Calculate md5 sum of file $ecriv
md5sum "$ecriv"
Calculate md5 sum of file $item and save it to variable 'md5'
md5=$(md5sum $item | cut -f1 -d\ )
Calculate md5 sum of files $source_file and $dest_file
md5sum "$source_file" "$dest_file"
Calculate md5 sum of file ${my_iso_file} and save it to variable 'md5'
md5="$(md5sum "${my_iso_file}")"
Calculate md5 sum of file ${my_iso_file} and save it to variable 'md5'
md5=`md5sum ${my_iso_file} | cut -b-32`
Calculate the md5 sum of hex byte 61
echo -n -e '\x61' | md5sum
Calculate the md5 sum of the md5 sum of all the files sorted under "$path"
find "$path" -type f -print0 | sort -z | xargs -r0 md5sum | md5sum
Calculate md5 sum of the md5 sum of all the sorted files under $path
find "$path" -type f -print0 | sort -z | xargs -r0 md5sum | md5sum
Calculate the md5 sum of the output of "du -csxb /path" and compare it against the md5 sum saved in "file"
du -csxb /path | md5sum -c file
Calculate the md5 sum of the tar archive of "dir"
tar c dir | md5sum
Calculate the md5sum of all the files with name "MyCProgram.c", ignoring case
find -iname "MyCProgram.c" -exec md5sum {} \;
Calculate the md5sum of the executable file of command "cc"
md5sum $(which cc)
Calculate the md5sum of the executable file of command "gcc"
md5sum $(which gcc)
Calculate the md5sum of the executable file of command 'c++'
md5sum `which c++`
Case-insensitive search all existing environment variables and their values for "shell".
env | grep -i shell
Change all "JPG" filename suffixes in current directory to "jpeg".
rename -v 's/\.JPG/\.jpeg/' *.JPG
Change all directories under "./bootstrap/cache/" to owner "apache" and group "laravel"
sudo find ./bootstrap/cache/ -type d -exec chown apache:laravel {} \;
Change all directories under "./storage/" to owner "apache" and group "laravel"
sudo find ./storage/ -type d -exec chown apache:laravel {} \;
Change all files in "~" which are owned by the group "vboxusers" to be owned by the user group "kent"
find ~ -group vboxusers -exec chown kent:kent {} \;
Change all files in the current directory tree to owner "xx"
find . \( \! -user xx -exec chown -- xx '{}' + -false \)
Change all file permissions to 664 and all directory permissions to 775 in directory tree "htdocs"
find htdocs -type f -exec chmod 664 {} + -o -type d -exec chmod 775 {} +
change cgi files to mode 755
find htdocs cgi-bin -name "*.cgi" -type f -exec chmod 755 {} \;
change cgi files to mode 755 under htdocs or cgi-bin directories
find htdocs cgi-bin -name "*.cgi" -type f -exec chmod 755 {} \;
Change directory to "$dir1" and resolve any symlinks in the resulting path
cd -P "$dir1"
Change directory to "/lib/modules/" of the current kernel release
cd /lib/modules/$(uname -r)/
Change directory to "/path/to/pdf"
cd /path/to/pdf
Change directory to the "lib" directory located two parent directories above the path to command "perl"
cd $(dirname $(dirname $(which perl)))/lib
Change directory to the alphabetically last path under the current directory
cd "$(find . -print0 | sort -z | tr '\0' '\n' | tail -1)"
Change directory to the basename of "$1" with ".tar.gz" removed
cd $(basename $1 .tar.gz)
Change directory to the current user's home directory
cd /home/`whoami`
Change directory to the directory containing the "oracle" executable
cd "$(dirname $(which oracle))"
Change directory to the directory containing the "oracle" executable
cd $(dirname $(which oracle))
Change directory to the directory containing the "oracle" executable
cd $(dirname `which oracle`)
Change directory to the directory containing the current script
cd $(dirname $(which $0) )
Change directory to the directory containing the executable file of command "oracle"
cd $(which oracle | xargs dirname)
Change directory to the directory containing file path "$1"
cd "$(dirname "$1")"
Change directory to the download directory specified in the current user's user-dirs.dirs file
cd "$(grep DOWNLOAD $HOME/.config/user-dirs.dirs | cut -f 2 -d "=" | tr "\"" "\n" | tr -d "\n")"
Change directory to the download directory specified in the current user's user-dirs.dirs file
cd "$(grep DOWNLOAD $HOME/.config/user-dirs.dirs | cut -f 2 -d "=" | tr "\"" "\n")"
Change directory to the output of command '~/marker.sh go "$@"'
cd $( ~/marker.sh go "$@" )
Change directory to parent directory and do not resolve any symlinks in the resulting path
cd -L ..
Change directory to the real path of the current working directory of process "$PID"
cd $(readlink /proc/$PID/cwd)
Change directory to the real path of the directory containing the current script
cd $(readlink -f $(dirname $0))
Change directory to the user's home directory
cd
change the extension of all the ".lst" files in the current folder to "a.lst"
find -name ‘*.lst’ -exec rename .lst a.lst {} \;
change the extension of all the files in the current folder to html excluding those html files and those which are present in another disk partition
find . -xtype f \! -iname *.html -exec mv -iv "{}" "{}.html" \;
Change file owner and group of "/path/to/yourapp" to root and print a diagnostic
chown -v root:root /path/to/yourapp
Change file permissions on all regular files within a directory
find /path/to/directory -type f -exec chmod 644 {} +
Change folder to the one where $0 link target file is located.
cd $(dirname $(readlink -f $0))
change the group of all directories in the current folder
find . -type d -exec chgrp usergroup {} \;
change the group of all the files in the file system which belong to the group with the gid 999
find / -group 999 -exec chgrp NEWGROUP {} \;
change the group of all the files which belong to the user edwarda to pubs
find / -user edwarda -exec chgrp pubs "{}" \;
change the group of all regular/normal files in the current directory
find . -type f -exec chgrp usergroup {} \;
Changes the group of defined file.
chgrp
change group of the file /var/lib/php/session to group lighttpd
chown -R :lighttpd /var/lib/php/session
change group of the file myfile to group friends
chown :friends myfile
Changes group ownership of '/etc/btsync/[prefered conf name].conf' to 'btsync'.
chgrp btsync /etc/btsync/[prefered conf name].conf
Changes group ownership of '/home/www-user/php_user.sh' to 'www-data'.
chgrp www-data /home/www-user/php_user.sh
Changes group ownership of '/var/run/fcgiwrap.socket' to 'forge'.
chgrp forge /var/run/fcgiwrap.socket
Changes group ownership of 'myprog' to 'groupb'.
chgrp groupb myprog
Changes group ownership of 'public' to 'pub'.
chgrp pub public
Changes group ownership of 'target_directory' to 'target_group'.
chgrp target_group target_directory
Changes group ownership of /sys/class/gpio/export and /sys/class/gpio/unexport to 'gpio'.
sudo chgrp gpio /sys/class/gpio/export /sys/class/gpio/unexport
Change group ownership to `foo' for files with GID=2000
find / -group 2000 -exec chgrp -h foo {} \;
change the group to "new_group" and permissions to 770 for all the files in the current folder
find . -name "*" -exec chgrp -v new_group '{}' \; -exec chmod -v 770 '{}' \;