Table of Contents
Linux - Command
Linux Command
To learn more about each command, read its associated man page (for example, type man ls at the shell prompt to read about the ls command).
| Command | Description |
|---|---|
| Network | |
| ifconfig | To detect the IP Adress |
| netstat -rn | routing table |
| Ctrl+C | interruption of script |
| hostname name | To set the hostname, name is the system name you want for your local machine (fully qualified domain name or not) |
| Navigation / NFS | |
| mkdir | make directory |
| cd | change directory ( cd .. is the shortcut for moving up one directory level). ex. cd “Entreprise Linux 2007” |
| ls | ls -a show the cached file |
| mv | Changes the names of directories and subdirectories mv old_name new_name |
| pwd | display the name of the current directory. The pwd command stands for “print working directory” |
| which | give the path of a file. Ex : “which java” return ”/usr/bin/java” |
| ln | make links (short cut) between files |
| df | Disk Free to know the used space (Example: df -h where h stands for human readable) |
| rm | delete a file |
| rmdir | delete a directory |
| CD Rom | |
| mount | On redhat linux 6 or below: mount /dev/hdc /mnt/cdrom and for above versions: mount /dev/cdrom /mnt/cdrom |
| Environment | |
| echo | To get the value of en environment variable (ex.: echo $ARBORPATH) |
| env or set | A long list of bash environment variables appears |
| Security | |
| whoami | Return the current user |
| Process | |
| top | display top CPU processes |
grep
grep filters content based on certain strings.
tail
tail prints the last ten lines of file.txt. Handy when viewing log files - you get the last 10 lines.
tail file.txt
Or even better use the -f option:
tail -f file.txt
which will dump the end of the file out to the screen on an ongoing basis, kind of a 'realtime' view. if you do this with logfiles you can watch exactly what's going on in the files as it's happening.