Useful Linux Commands
This is a compilation of rather rare, useful Linux Commands.
- How to mount remote folders using sshfs
- How to scan for wireless networks
- How to backup mysql database and compress backup file
- How to check for disk space
- How to display connection counts by ip address
- How to mount a network share
- How to find files modified recently or at a certain date
- How to find text within files and display file names only
- How to retrieve OS version and Kernel info
- How to delete all hidden .svn files and folders
- MySQL auto repair, check and optimize all the tables on all databases running on a server
- How to show line numbers in vi / vim editor
- MySQL – Select records in one table not found in the other
- Refresh Locate Database on Mac OS
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
If you know some exotic but useful unix commands, we’d be happy to add them. Simply drop us a line: submit@itecsoftware.com