2/29/2024 0 Comments Ls grep add all jpg file to txt![]() List shares on windows machine or samba server Windows networking (Note samba is the package that provides all this windows specific networking support)įind the windows (netbios) name associated with ip address Lookup whois info for hostname or ip address Lookup local ip address (equivalent to host `hostname`) Lookup DNS ip address for name or vice versa Tc qdisc add dev lo root handle 1:0 netem delay 20msecĪdd 20ms latency to loopback device (for testing) Networking (Note ifconfig, route, mii-tool, nslookup commands are obsolete)Įthtool -change eth0 autoneg off speed 100 duplex full Wget -nv -spider -force-html -i bookmarks.htmlĮfficiently update a local copy of a site (handy from cron) Store local browsable version of a page to the current dirĬontinue downloading a partially downloaded fileĭownload a set of files to the current directoryĭo a low priority download (limit to 20 KB/s in this case) Ssh -g -L 8080:localhost:80 connections to $HOSTNAME:8080 out to $HOST:80 Run command on $HOST as $USER (default command=shell)Ĭopy with permissions to $USER's home directory on $HOST Synchronize current directory with remote one Mirror web site (using compression and encryption) Rsync -az -e ssh -delete ~/public_html/ :'~/public_html' Do multiple times for troublesome downloads Rsync (Use the -dry-run option for testing) ( tar -c /dir/to/copy ) | ssh -C 'cd /where/to/ & tar -x -p'Ĭopy (with permissions) copy/ dir to remote:/where/to/ dirĭd bs=1M if=/dev/sda | gzip | ssh 'dd of=sda.gz' ) | ( cd /where/to/ & tar -x -p )Ĭopy (with permissions) contents of copy/ dir to /where/to/ ( tar -c /dir/to/copy ) | ( cd /where/to/ & tar -x -p )Ĭopy (with permissions) copy/ dir to /where/to/ dir Make encrypted archive of dir/ on remote machineįind dir/ -name '*.txt' | tar -c -files-from=- | bzip2 > dir_2įind dir/ -name '*.txt' | xargs cp -a -target-directory=dir_txt/ -parents Tar -c dir/ | gzip | gpg -c | ssh 'dd of=.gpg' Highlight occurances of regular expression in dictionaryĮxtract archive (use gzip instead of bzip2 for tar.gz files) Grep -color reference /usr/share/dict/words Quickly search (sorted) dictionary for prefix Process each item with multiple commands (in while loop)įind files not readable by all (useful for web site)įind dirs not accessible by all (useful for web site) ![]() Search all regular files for 'example' in this dirįind -maxdepth 1 -type d | while read dir do echo $dir echo cmd2 done Search all regular files for 'example' in this dir and belowįind -maxdepth 1 -type f | xargs grep -F 'example' Put current dir on stack so you can popd back to itįind -name '*.' | xargs grep -E 'expr'įind -type f -print0 | xargs -r0 grep -F 'example' ![]() Go to dir, execute command and return to current dir Run a low priority command (The "info" reader in this case) All these commands have been tested both on Fedora and Ubuntu. are valid/safe to paste without modification into a terminal, so you may want to keep a terminal window open while reading this so you can cut & paste.The examples in this guide cover a wide range of renaming scenarios and can be easily adapted to fit other needs.This is a linux command line reference for common operations. We can also use Thunar’s Bulk Rename application when we prefer to use GUI over the command line. It’s possible to use default Bash utilities for all of your bulk renaming on Linux, but the rename and mmv tools make it a lot easier. Change all file names to lowercase (using mmv utility). $ for f in *.jpeg do mv "$f" "$ doneĮxample 5. $ for f in `ls | grep ` do mv "$f" "`echo $f | tr 'a-z' 'A-Z'`" doneĮxample 3. $ for f in `ls | grep ` do mv "$f" "`echo $f | tr 'A-Z' 'a-z'`" doneĮxample 2. Some examples also rely on other default Linux utilities like ls, find, xargs, etc.Įxample 1. The mv command is a default part of Linux and can be used to rename multiple files, but a little scripting is required to do the job. Note that some examples will also rename directories. Most of these commands can easily be tweaked to work recursively. The examples in this guide are used to rename all files in your present working directory.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |