sudo mount -t smbfs //san/ics /mnt/ics -o username=user,password=pass
How to find files modified recently or at a certain date
find . -mtime -1
(find all files in the current directory and subdirectories, modified within the last 24 hours) find ~ -mmin -90
(find all files in the home directory, modified within the past 90 minutes) find ~ -type f -mmin -90 | xargs ls -l
(same as above, but with extended output information)
How to find text within files and display file names only
find . | xargs grep ‘string’ -sl
(-s is for summary and won’t display warning messages, -l is for list, so we get just the filename)
How to retrieve OS version and Kernel info
uname -a print all information uname -r print kernel release uname -v print kernel version and info
How to delete all hidden .svn files and folders
find . -name .svn -print0 | xargs -0 rm -rf
MySQL repair, check and optimize all tables on all databases running on a server
Useful Linux Commands
This is a compilation of rather rare, useful Linux Commands asked for by users, that do not warrant for a full article.
sshfs example.com:/stuff /media/music
(unmount “fusermount -u /media/music”)
iwlist eth1 scanning (replace eth1 with your interface)
mysqldump -ppassword -uuser -phost database_name | gzip > backup_name.sql.gz
df -h
netstat -ntu | awk ‘{print $5}’ | cut -d: -f1 | sort | uniq -c | sort -nr
sudo mount -t smbfs //san/ics /mnt/ics -o username=user,password=pass
find . -mtime -1
(find all files in the current directory and subdirectories, modified within the last 24 hours)
find ~ -mmin -90
(find all files in the home directory, modified within the past 90 minutes)
find ~ -type f -mmin -90 | xargs ls -l
(same as above, but with extended output information)
find . | xargs grep ‘string’ -sl
(-s is for summary and won’t display warning messages, -l is for list, so we get just the filename)
uname -a print all information
uname -r print kernel release
uname -v print kernel version and info
find . -name .svn -print0 | xargs -0 rm -rf
mysqlcheck -u root -p password –auto-repair –check –optimize –all-databases
:set number or
:set nu
select * from table1 t1 left join table2 t2 on t1.id = t2.id where t2.id is null
sudo /usr/libexec/locate.updatedb
sed -n ’12000,12002p’ file_name
rm -rf `find . -type d -name .svn`
tar czvf img_0.tar.gz `find 0 -name ‘*[!thumbnail]*.jpg’`
If you know some exotic but useful unix commands, we’d be happy to add them. Simply drop us a line: submit@itecsoftware.com