I have compiled several linux CLI basic tips and quick tricks that solves simple issues of daily routines and objectives. Most probably they are most commonly used by others too, but who knows?
Here are a few old tricks and linux workarounds that still works with Fedora distro and probably works with CentOS and RedHat.
These commands were all done as super user root. I suggest not to try this if you don't know what the command is for, use at your own risk!!!
1. How to create a return email address when using mutt ?
# export REPLYTO=youremail@yourdomain.com
2. How to dump a website into your terminal screen ?
# elinks -dump "http://www.gmanews.tv/forex.php"
# lynx -dump "http://www.gmanews.tv/forex.php"
# links -dump "http://www.gmanews.tv/forex.php"
3. How to dump a website into a file ?
# elinks -dump "http://www.gmanews.tv/forex.php" > file1
# lynx -dump "http://www.gmanews.tv/forex.php" > file2
# links -dump "http://www.gmanews.tv/forex.php" > file3
3. How to sort batch of files containing alpha numeric characters in a file with one command ?
# cat filename101*.txt | sort -n
4. How to remove duplicate lines from a file ?
# uniq < filename01.txt
5. How to force rotate of all your defined log files located in /var/log/ ?
# logrotate -f /etc/logrotate.conf
6. How to change the interval time of your daily and weekly system cron jobs ?
# vi /etc/anacrontab
7. How to start X / Gnome from terminal ?
# startx
8. How to do a whole new xorg.conf setup for your nonworking/epileptic X which was caused recent xorg.conf misconfiguration ?
# mv /etc/X11/xorg.conf /etc/X11/xorg.conf.old
# gdmsetup
9. Do you have a very old and nice webtool for newbies or junior system admins?
Click here
10. How to launch and run a program into background ?
# program-name &
10. How to locate and find file(s) in CLI ?
# find /foldername -name name-of-file
Ex.
# find /home -name *vertito*
# locate *vertito*
11. For script kiddies who successfully hacked a box, LOL. How to know your current dropped user, shell id, group id, groups your shell belongs to after successfully hacking into a linux box? :)
# id
12. How to know who is currently active from ssh connection from your server ?
# w
13. How to know all your opened UDP ports and connections ?
# ss -u -a
14. What are the most commonly known world writeable and readable folders?
# cd /tmp
# cd /dev/shm
So watch out for any scripts or file changes there!
15. How to build rpm package from source file (*.src.rpm) ?
# rpmbuild --rebuild *.src.rpm
Most probably, you'll find the sources in /root/rpmbuild/SOURCES and the RPM file in /root/rpmbuild/RPMS . If not, try /usr/src/redhat/SOURCES and /usr/src/redhat/RPMS
16. How to find all files from a particular folder that contains this string and do it recursively ?
# find /home/vertito -exec grep -li myownstring {} \;
17. How to find a specific filename and delete it ?
# find / -name specific-filename.txt -exec rm -rf {} \;
18. How to trim my temporary files and delete the ones that are more than 1 month old?
# find /tmp -mtime +31 -exec rm -rf {} \;
19. How to know the descriptions, functions, and more info a a linux command ?
Ex.
# man elinks
# apropos elinks
# whatis elinks
# info elinks
20. How to know from which rpm package does a particular library belongs to ?
Ex. /lib/libcap.so
# rpm -qf /lib/libcap.so
21. How to find out interesting port of a particular host ?
# nmap host-IP-Address-here
22. How to ping one subnet class of IP address or group of IP address ?
# fping -g 192.168.100.0/27
$ fping -g 192.168.1.1 192.168.1.254
23. How to know if a port is open ?
Example: port 25
# telnet IP-address 25
# nc -dz IP-address 25
24. How to watch for file and file size changes of one folder live and not by email ?
# cd your-folder
# watch ls -la
25. How to divide 9999999999999999 by 3 directly from terminal ?
How to use a terminal based calculator?
# echo '9999999999999999/3' | bc -l
26. How to print line numbers of each output line of a text file ?
# cat -n yourfile.txt
27. How to negate a grep result?
# grep -v "null" yourfilename
28. How to list statistics from your network ?
# netstat -s
29. What is the country code for a particular country ?
# grep -i philippines /usr/share/zoneinfo/iso3166.tab
30. How to find out who owns and manages a particular domain ?
# whois google.com
31. How to get the resolved IP of a domain ?
# nslookup google.com
# host google.com
# dig google.com
32. How to say hello and goodbye to your system log file ?
# logger 'Hello and Goodbye'
33. How to list out all your USB current connections ?
# lsusb
verbose
# lsusb -v
34. How to list out all your PCI card connections ?
# lspci
verbose
# lspci -v
35. How to lock/unlock a bash enabled user shell account ?
# passwd -l useraccount
# passwd -u useraccount
# passwd -S useraccount
36. How to limit and change available shell accounts for user's shell assignment ?
# vi /etc/shells
37. How to change the default values when adding new user accounts ?
# vi /etc/default/useradd
38. How to create default files automatically every time a new user accounts is created ?
# cp /home/vertito/whateverfile.txt /etc/skel
# useradd -d /home/newuser newuser
39. How to go the easy way to home folder of a particular user if you have multinested virtual home folders?
# cd ~hisusername
40. How to browse and download the whole pages of a particular WWW site in one shot ?
# wget -p --progress=dot http://www.google.com
41. How to safely mark badblocks from another ext2/ext3 linux harddisk ?
# umount /dev/other-harddisk2
# e2fsck -c /dev/other-harddisk2
42. How to create a new ext3 filesytem with bad-block checking from your secondary harddisk?
# mkfs.ext3 -c /dev/other-harddisk2
43. How to compare bzip2 compressed files ?
# bzdiff file1 file2
44. How to detect hardware monitoring chips and load modules related to newly detected chips?
# sensors-detect
>45. How to know if your postfix or sendmail is running ?
# ps axuw | grep sendmail
# ps axuw | grep postfix
46. How to change the default port when spamassassin is launched?
# vi /etc/sysconfig/spamassassin
47. How to disable postfix permanently after reboot ?
# chkconfig --levels 345 postfix off
48. How to know the number of children spawned by apache ?
# ps axuw | grep http | wc -l
49. How to avoid a module from being loaded by kernel during startup and blacklist it permanently?
# vi /etc/modprobe.d/blacklist
50. How to quickly count all your queued mail when you box is really hogging due to spam bruteforce attacks and spam mailer?
# mailq | wc -l
How to smile ?
:)
Hope this helps abit.
Subscription
Categories
- HowTos (612)
- Linux Devices (40)
- Linux Diggs (620)
- Linux News (1541)
- Linux Videos (24)
Recent Posts
Blog Archive
-
▼
2007
(340)
-
▼
July
(107)
- AMSN messenger install howto
- firefox browser - yum update howto
- kopete messenger install howto
- Gaim pidgin messenger install howto
- xmms - multimedia player install howto
- UltraDMA - speedup your harddisk howto
- sabayon - user profile manager howto
- 50 quick linux command tips part 3
- No negotiations with Microsoft in progress
- connect SamSung D820 mobile to linux howto
- yum from ISO image or CD install howto
- missing portmap reinstall howto
- 50 quick linux command tips part 2
- 50 quick linux command tips part 1
- desktop wiki install howto
- NASA tests Linux for spacecraft control
- warzone 2100 strategy 3d game install howto
- motd - message of the day
- more with kernel name version howto
- stop and start networking service howto
- change network proxy preference howto
- alexa firefox toolbar plugin install howto
- reboot / halt system via CLI howto
- gparted partitioning install howto
- google picasa install howto
- pine and pico install howto
- adobe/macromedia flash player test and install howto
- realplayer install howto
- Microsoft's TrueType core fonts install howto
- Why Choose Fedora? (Fedora vs. Ubuntu)
- Microsoft vs Opensource
- the df command
- linux possessed by monsterz
- change display setting howto
- NTP clock synchronization howto
- qtparted partitioning magic install howto
- host name and host aliases explained
- IP aliasing - virtual IP howto
- viruskiller on linux
- change keyboard language setting
- changing ethernet card settings howto
- TIP: WiFi with chillispot and linux
- play tennis the linux way
- sudoku game install howto
- my linux box talked to me
- CD/DVD burning software install howto
- A SYSAD BLOG - LINUX: list out active host connect...
- list out active host connection howto
- more with linux command named history
- GnuPG and enigmail thunderbird add-ons
- PDF file readers install howto
- digikam - KDE photo management install howto
- gnome floppy formatter
- f-spot Gnome photo manager install howto
- VLC media player install howto
- ping IP subnet block howto
- TIP: find and delete files recursively
- list out opened host ports howto
- TIP: linux process priority scheduling management
- TIP: spammer sending email using squid
- remount partition as read only howto
- additional swap file howto
- CrossOver install howto
- system-config-securitylevel-tui and lokkit howto
- format a windows partition from linux hadrdisk
- TIP: monitoring while mounting USB devices
- zero-sized a file without permission / ownership c...
- TIP: auto create mail spool when adding user
- md5sum checksum howto
- IP address to country lookup howto
- gnome mail notification install howto
- add new harddisk to existing linux system
- TIP: block an IP address
- disk space report
- more trace route command alternatives
- changing your hardware / software clock howto
- other interesting ping commands
- send email via CLI howto
- adding static route howto
- send message to all logged in users
- unzip zip untar tar bzip2 bunzip2 gzip gunzip file...
- format of /etc/passwd, /etc/shadow and /etc/group
- remove user's cron jobs howto
- find the user's files howto
- passphraseless + passwordless ssh howto
- passwordless ssh howto
- X11 Forwarding via ssh howto
- skype install howto
- disable IPv6
- lsusb - list all USB devices
- make yum faster
- lspci - list all PCI devices
- kill a process
- beginners CLI guide for static ip address
- the pidof command
- retrieve data from mysql using bash script
- VirtualBox install howto
- call bash script inside php web page
- alternative linux browsers
- last / currently logged in users
-
▼
July
(107)
Thursday, July 26, 2007
50 quick linux command tips part 1
Subscribe to:
Post Comments (Atom)
ILoveTux - howtos and news | About | Contact | TOS | Policy
0 comments:
Post a Comment