Basic+Linux+Commands

=Basic Linux Bash Shell Commands.= Here's a list of some of the basic Bash shell commands. For more information, search the net, use [] or use the man pages for the relevant commands.

cd
Change the working directory. code format="bash" $ cd /bin code

chmod
Change access permissions of files. code format="bash" $ chmod +x helloworld code

cp
Copies a file. code format="bash" $ cp lorem.txt copy_of_lorem.txt code

dir
List directory contents. code format="bash" $ dir copy_of_lorem.txt lorem.txt moo.txt www code

echo
Display a line of text. code format="bash" $ echo foobar foobar code

fgrep
Print lines matching a pattern in a file. code format="bash" $ fgrep "irure dolor" lorem.txt commodo consequat. Duis aute irure dolor in reprehenderit in voluptate code

find
Search for files in a directory hierarchy. code format="bash" $ find hello* hello_world hello_world.c code

grep
Print lines matching a pattern. code format="bash" $ grep -i apple fruitlist.txt apple code

kill
End a process. code format="bash" $ kill -9 18298 -bash: kill: (18298) - Operation not permitted code

less
Read files, for the most part better than tail After having invoked the program on a file you can press: F : Follow what is being written to the file ala tail -f, however you can discontinue at your leasure and restart it again if that suits you g : Move to the beginning of file G : Move to the end of a file / : Search for the string specified just after / code format="bash" $ less /var/log/messages code

ln
Make links between files. code format="bash" $ ln -s data.txt symlink.txt code

ls
List directory contents. code format="bash" $ ls copy_of_lorem.txt lorem.txt moo.txt www code

man
Opens the manual page for a software or function. code format="bash" $ man bash code

mkdir
Makes a directory. code format="bash" $ mkdir foobar code

mv
Moves a file. code format="bash" $ mv lorem.txt ipsum.txt code

ping
Pings a host. code format="bash" $ ping -c 2 127.0.0.1 PING 127.0.0.1 (127.0.0.1) 56(84) bytes of data. 64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.048 ms 64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.052 ms

--- 127.0.0.1 ping statistics --- 2 packets transmitted, 2 received, 0% packet loss, time 999ms rtt min/avg/max/mdev = 0.048/0.050/0.052/0.002 ms code

ps
Outputs running processes. code format="bash" $ ps PID TTY TIME CMD 21542 pts/12 00:00:00 bash 27706 pts/12 00:00:00 ps code

pstree
Display a tree of processes. code format="bash" $ pstree init-+-2*[BitchX] code
 * -3*[bash---sleep]
 * -fetchmail
 * -screen-+-bash---irssi
 * `-bash---ctorrent
 * -screen-+-bash---lisp.run
 * |-bash---vi
 * |-2*[bash]
 * `-bash---lynx
 * -2*[screen---bash---irssi]
 * -screen---irssi

pwd
Outputs the name of current working directory. code format="bash" $ pwd /home/stud code

rm
Removes a file or directory. code format="bash" $ rm lorem.txt code

rmdir
Removes a directory. code format="bash" $ rmdir foobar code

tail
Output the last part of files. code format="bash" $ tail -2 lorem.txt occaecat cupidatat non proident, sunt in culpa qui officia deserunt code