Useful Linux commands.

Joined April 2012
Photos and videos
"sudo" - allows a permitted user to execute a command as the superuser or another user, as specified in the sudoers file.
2
62
Returns > Just some text
$echo "Just some text"
"echo" - Display a line of text.
"$df -h"For human readable space usage.
2
"df" - Report file system disk space usage
2
Result: Linux MachineName 3.0.0-17-generic #30-Ubuntu SMP Thu Mar 8 20:45:39 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
Example $ uname -a
1
"uname" Prints system information.
2
$ "free -b" Display amount of free and used memory in bytes.
2
$ "free -k" Display amount of free and used memory in kilobytes.
2
$ "free -m" Display amount of free and used memory in megabytes.
$ "free -g" Display amount of free and used memory in gigabytes.
1
"free" - Display amount of free and used memory in the system.
"locate" - find files by name. Usage $ locate "fileName"
3
"whoami" prints current session userid
"touch" - creates new file if it doesn't exist or changes the timestamp of already existing file. $touch fileName
1
"cat" - combines and prints files to standard output. $ cat file //Prints the content of a file $ cat file1 file2 > file3 //Combines files
Probably one of most useful commands. $find -name '*.[ch]' | xargs grep -E 'search_term' Search 'search_term' in this directory recursively.
2
3