Linux Tutorial Part 1: Basic Shell Skills 1


1. uname

‘uname -a’ returns :

  • OS – Linux
  • Fully Qualified Domain Name (FQDN)
  • Kernel version – 2.6.31…
  • 2.6 = major version
  • 31= minor version
  • 14 = Anything else after the minor version indicates that the kernel was patched by the distributor
  • Date and time that the kernel was compiled
uname

2. ifconfig

  • lists out all the network interfaces
  • useful to check or set the IP of an interface.
ifconfig

3. tty – reveals the current terminal
4. whoami – reveals the currently logged-in user
5. which – reveals where in the search path a program is located

6. echo – prints to the screen

  • echo $PATH – dumps the current path to STDOUT
  • echo $PWD – dumps the contents of the $PWD variable
  • echo $OLDPWD – dumps the most recently visited directory
tty,whoami, echo, $PATH

7. set – prints and optionally sets shell variables
8. clear – clears the screen or terminal
9. reset – resets the screen buffer
10. history – reveals your command history

  • !362 – executes the 362th command in our history
  • command history is maintained on a per-user basis via:
  • ~/.bash_history
  • ~ = users’s $HOME directory in the BASH shell
history

11. pwd – prints the working directory
12. cd – changes directory to desired directory

  • ‘cd ‘ with no options changes to the $HOME directory
  • ‘cd ~’ changes to the $HOME directory
  • ‘cd /’ changes to the root of the file system
  • ‘cd Desktop/’ changes us to the relative directory ‘Desktop’
  • ‘cd ..’ changes us one-level up in the directory tree
  • ‘cd ../..’ changes us two-levels up in the directory tree

13. Arrow keys (up and down) navigates through your command history
14. ls – lists files and directories

  • ls / – lists the contents of the ‘/’ mount point
  • ls -l – lists the contents of a directory in long format:
  • Includes: permissions, links, ownership, size, date, name
  • ls -ld /etc – lists properties of the directory ‘/etc’, NOT the contents of ‘/etc’
  • ls -ltr – sorts chronologically from older to newer (bottom)
  • ls –help – returns possible usage information
  • ls -a – reveals hidden files. e.g. ‘.bash_history’
  • files or directories prefixed with ‘.’ are hidden. e.g. ‘.bash_history’
pwd, ls , .bash_history

15. cat : to retrieve information from a file as in the os version in our case.

Output
Advertisements
Linux Tutorial Part 1: Basic Shell Skills 1

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s