Find filename recursively on terminal

Find by filename find . -name xxx.txtfind /directory -name "xxx.txt"find . -print | grep -i "xxx.txt"    Find by size find . -type f -size +50Kfind . -type f -size +50Mfind . -type f -size +50M -exec ls -lh {} \; | awk '{print $9 ": " $5}' Find by size using disk usage...

How to change hostname for Ubuntu server

Edit two files below: sudo nano /etc/hostnamesudo nano /etc/hosts To apply changes: sudo /etc/init.d/networking restart or sudo service networking restart...

How to assign static IP address and bridging for ubuntu server

 Edit your interfaces sudo nano /etc/network/interfaces  Enter your IP address information # interfaces(5) file used by ifup(8) and ifdown(8)auto loiface lo inet loopbackauto eth0iface eth0 inet staticaddress 192.168.1.3gateway 192.168.1.1netmask 255.255.255.0dns-nameservers 8.8.8.8 8.8.4.4 Restart network interface and services sudo ifdown eth0 && sudo ifup eth0sudo /etc/init.d/networking restartsudo service network-manager restartsudo service networking restartsudo service resolvconf...

How to change mirrors in Ubuntu server from regional to main (source.list)

Problem: sudo apt-get updateW: Failed to fetch http://sg.archive.ubuntu.com/ubuntu/dists/precise-backports/multiverse/binary-i386/Packages 404 Not Found   Solution: sudo nano /etc/apt/sources.list Repalce http://xxx.archive.ubuntu.com/ubuntu with below for all http://archive.ubuntu.com/ubuntu...

Chmod Chown recursively

Chmod recursively chmod -R +x folder_namechmod -R 774 folder_namechmod -R 774 . Chown recursively chown -R www-data folder_name...

Recursively Zip a directory on Linux

Desired filename is the first argument and folder you wish to recursively zip is second argument. zip -r create.zip /direcotry/to/zip/ To exclude some file extension cd /path/to/dirzip -r create.zip . -x "*.log" -x "*.cache"  ...

Check disk usage on Linux system or Ubuntu

Display the disk space usage on all mounted filesystems. -T option shows the filesystem type. df -h -T   Display the size of a particular directory and it’s sub directories: du -ch | grep totaldu -sh c for totals summarizeh human-readable Show size of each directories du -sh ./*  ...

How to backup files using tar

To create tar: tar czvf backup.tar.gz foldername/tar czvf everything.tar.gz * To extract out: tar -zxvf extractme.tar.gz...

grep string recursively and return line number

To grep a string recursively grep -rin "string" /directory Add -w flag for a word search grep -rinw "string" /directory Add -l flag to list file name only grep -rinl "string" /directory grep only from certain file extensions grep -rinl "string" /directory --include=*.php -r recursively -i ignore-case -n print line number -w word search...

Scroll to top