Created Thursday 26/07/2007
As I go along and remember those linux commands, I'll be adding them here as time goes by. They don't pop out of my tiny-winny braincells easily when I needed them most.
Here goes nothing.
1. How to know which ports are listening from your IP address?
# nmap -sT -O your-ip-address
2. How to grep an exact match?
# grep -w textfile.txt
3. How to reverse grep matches?
# grep -v textfile.txt
#
4. How to know which service name is what port?
Assuming port 443
# cat testfile.txt | grep -w 443
5. How to get the first 10 lines of a file?
# head -10 testfile.txt
6. How to get the last 10 lines of a file?
# tail -10 testfile.txt
7. How to get the first column of a file?
# awk '{print $1}' testfile.txt
8. How to get the first and second columd of a file?
# awk '{print $1 " " $2}' testfile.txt
9. How to get the first column of a file having consistent field separator pattern?
Field separator character patterns is /
# awk -F/ '{print $1}' testfile.txt
10. How to get the second column of a file having consistent field separator pattern?
# awk -F/ '{print $2}' testfile.txt
11. How to show contents of a text file?
# cat testfile.txt
12. How to show contents of text file pausing ever page or one screenful at a time?
# more testfile.txt
# less testfile.txt
13. What is the big difference between more and less?
less linux command has much more extensive enhancements compared with more.
You can also scroll up interactively via control keystrokes using less while the other one does not allow you to do that.
less does not need to read the entire file to buffer when showing a screenful content of a file and furthermorel less is faster than more on accessing big filesize.
14. How do you delete all numbers and digits from contents of a file?
# tr -d [:digit:] < testfile.txt
15. How do you sort contents of a text file in descending order?
# sort -r newfile.txt
16. How do you create a file using touch (without opening it interactively for writing)?
# touch newfile.txt
17. How do you change the date of all files in one folder?
# touch *
18. How do you create a file using tee?
# tee newfile.txt
and start typing, press
19. How do you query currently installed package offline from your system?
# rpm -qa sendmail
20. How do you query packages for something-like package ?
# rpm -qa | grep sendmail
# rpm -qa *sendmail*
21. What files comes with a something package?
# rpm -qa postfix*
# rpm -ql postfix-2.4.3-2.fc7
22. What is this something package?
# rpm -qi postfix-2.4.3-2.fc7
23. Where does rpm stores its rpm database?
# cd /var/lib/rpm
# ls -la __*
24. How to mount CD drive after inserting the disk?
# mount /dev/cdrom /mnt/CD
25. How to know if fedora detects your Nokia N70 via USB?
# lsusb
26. How to change system date ?
# date -s "December 25 2007 01:01:01"
27. How to know your free base memory and other memory / swap statistics ?
# free
28. How to show disk space usage of your filesystem in human readable form?
# df -ah
29. How to get the top 10 of your mbox mail users?
# cd /var/spool/mail
# ls -lS | head -10
30. How to find process ID of a running service like httpd?
# pidof httpd
31. How to locate a binary file, command source and its man pages?
# whereis ping
32. How to find the location of a executable file that could have been executed when entered from a prompt?
# which ping
33. How to download ISO or any file from web using command line?
# wget -c www.google.com/testfile.txt
# wget -c ftp://google.com/google.ISO
34. How to transfer file via ssh?
# scp -c testfile.txt user@remote-hostname
35. How to transfer files that has been only changed from one host to another without taking comparison?
# rsync -avz remoteserver:/home/remotefolder /home/localfolder
36. How to transfer your identity.pub into a remote machine's authorized_keys?
# ssh-copy-id -i identity-rsa-dsa.pub user@remote-hostname
37. How to know who you are in a shell?
# whoami
38. How to get more real-time view linux process stats and info?
# top
39. How to issue a continuous trace route to a host?
# mtr host-ip-addres
40. How to trace route without resolving IP address?
# mtr --no-dns hostname
41. What is another text-based alternative to chkconfig?
# ntsysv
42. How to list out current cron jobs?
# crontab -l
43. How to get the CPU time?
# clock
44. How to set date and time from NTP server?
# ntpdate 0.fedora.pool.ntp.org
45. How to show current system path?
# set | grep PATH
46. How to list out currently loaded kernel modules?
# lsmod
47. How to know the total days of your system without reboot?
# uptime
48. How to get a system bootstrapped from redhat network?
# /usr/bin/go-rhn.sh
49. How to see current running user jobs?
# jobs
50. How to edit text files from terminal?
# vi textfile.txt
# nano textfile.txt
# joe textfile.txt
# vim textfile.txt
# pico textfile.txt (if pico is installed - Pico is a trademark of the University of Washington)
# tee vv
Hope this helps a bit.
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 2
Subscribe to:
Post Comments (Atom)
ILoveTux - howtos and news | About | Contact | TOS | Policy
0 comments:
Post a Comment