Linux is a UNIX-like operating system. On this page you find the some useful information and the most common commands used in the Linux environment.
Learn to love it, you won’t be disappointed.
If you want more information about a command, the usual way is to use the
--help argument or the
man <command> command.
For windows people - Directory == Folder
Here the user is located in their home directory
And here the user would be in current_directory:
Absolute path, starts from root directory:
Relative path, starts from current directory:
Allows users to run programs with the security privileges of another user, by default the superuser. Use this command in front of any command if you get access denied, or don’t, you may potentially destroy something.
username@linux:~$ sudo <command>
Almost every linux command comes with a manual. Use
man to access it.
If you would like to know more about the command
ls, you would type:
username@linux:~/$ man ls
To exit the manual, press
start process by simply typing
top will show all running processes.
TODO: update list (DONT USE THIS!!!)
Mem: 60964K used, 1532K free, 0K shrd, 9044K buff, 36972K cached CPU: 8% usr 57% sys 0% nice 4% idle 29% io 0% irq 0% softirq Load average: 1.88 0.88 0.39 PID PPID USER STAT VSZ %MEM %CPU COMMAND 200 198 root S 214m 350% 44% ./tuska_interface 19 2 root DW< 0 0% 14% [mmcqd] 249 233 root R 3144 5% 0% top 12 2 root SW< 0 0% 0% [kswapd0] 203 1 root S 3144 5% 0% telnetd -p 23 -b 10.10.10.4 233 203 root S 3144 5% 0% -sh 198 1 root S 3144 5% 0% /bin/sh /etc/init.d/rcS 1 0 root S 3140 5% 0% init 36 1 root S < 1592 3% 0% /sbin/udevd --daemon 17 2 root SW< 0 0% 0% [ubi_bgt0d] 9 2 root SW< 0 0% 0% [kmmcd] 2 0 root SW< 0 0% 0% [kthreadd] 3 2 root SW< 0 0% 0% [ksoftirqd/0] 4 2 root SW< 0 0% 0% [events/0] 5 2 root SW< 0 0% 0% [khelper] 6 2 root SW< 0 0% 0% [kblockd/0] 7 2 root SW< 0 0% 0% [ksuspend_usbd] 8 2 root SW< 0 0% 0% [khubd] 10 2 root SW 0 0% 0% [pdflush] 11 2 root SW 0 0% 0% [pdflush] 13 2 root SW< 0 0% 0% [aio/0] 14 2 root SW< 0 0% 0% [nfsiod] 15 2 root SW< 0 0% 0% [scsi_tgtd/0] 16 2 root SW< 0 0% 0% [mtdblockd] 18 2 root SW< 0 0% 0% [rpciod/0] 191 2 root SW< 0 0% 0% [ubi_bgt1d] 195 2 root SW< 0 0% 0% [ubifs_bgt1_0]
For a list of commands you can use inside
top, press the
h key while the program is running.
As an example, you kan press
k to kill a process. Just enter the process ID (PID) after pressing
k, or press enter to kill the topmost process.
To terminate a process outside
kill PID, where
PID is the process you want dead.
Self explanatory, prints where you are in directory hierarchy.
Prints the absolute path for the current working directory, AKA where you currently are.
Lists all files in current or specified directory.
List all files in the current directory, here Downloads:
List all files inside the Music/classic directory:
username@linux:~$ ls Music/classic
Move inside a directory:
username@linux:~$ cd <directory_path>
To move to the parent directory:
username@linux:~$ cd ..
. refers to current directory, while
.. refers to the parent.
username@linux:~$ rm awesomePythonProgram.py
Remove a directory:
username@linux:~$ rm -r awesomeDirectory
-f is used to remove forcefully:
username@linux:~$ rm -rf awesomeDirectory
Copy a file to a target. If the target is a directory, the filename will remain unchanged:
username@linux:~$ cp sourcefile tagetdirectroy
This would also rename the new file from
username@linux:~$ cp a.txt tagetdirectroy/b.txt
-r to copy a directory and its contents:
username@linux:~$ cp -r sourcedirectory targetdirectory
Use this to move a file/directory to its destination:
username@linux:~$ mv source taget
Move multiple files into a directory:
username@linux:~$ mv file1.txt file.2.txt file3.txt directory
Move all files with .py extension into a directory
username@linux:~$ mv *.py directory
b.txt by moving inside same directory:
username@linux:~$ mv a.txt b.txt
mv can, like
cp, also move directories.
Used to create directories.
username@linux:~$ mkdir directoryname
Use this to ping a website. useful if you want to test your network connection or if a server is up.
username@linux:$ ping www.google.com
Use this to remote access a server, e.g. tuxedo.
username@linux:$ ssh user@server
To connect using a different port than the default 22, use the
username@linux:$ ssh user@server -p 1234
The following will connect to tuxedo, to your account:
username@linux:$ ssh email@example.com
More about tuxedo: tuxedo-wiki
By default, the telnet port is port 23. Few other famous ports are:
7 – echo port,
25 – SMTP, use to send mail
79 – Finger, provides information on other users of the network
username@linux:$ telnet host <port>
Shows your network interfaces and displays information about them. Similar to
ipconfig on Windows.
Show all network interfaces:
Show a specific interface:
username@linux:$ ifconfig eth0
This command is being slownly replaced py
ip. Try to do
man ip to read more about it if it is available on your system.
Almost the same as
ifconfig but only displays wireless interfaces.
username@linux:$ whois www.google.com
TODO: improve description
Makes queries to the DNS server to translate IP to a name, or vice versa. eg. nslookup miniclip.com will gives you the IP of miniclip.com
Useful for tracing the route of IP packets. The packet causes messages to be sent back from all gateways in between the source and destination by increasing the number of hopes by 1 each time.
This needs its own section.
Different text editors:
|sudo||“superuser do”. Use this command infront of any command if you get access denied.|
|man||Manual for each command.|
|top||Rerminal task manager|
|pwd||Print working directory|
|ls||Lists all files in current or specified directory.|
|cd||Move between directories|
|rm||Remove a file|
|rm -r||Remove a directory|
|cp||Copy a file|
|cp -r||Copy a directory|
|mv||Move a file|
|mkdir||Create new directory|
|ping||Ping server/website to test network connection.|
|ssh||Remote access computer or server.|
|ifconfig||Network interface configuration and info.|
|iwconfig||Network interface configuration and info for wireless connections only.|
|nslookup||Translate IP address to name|
|traceroute||Tracing route of IP address|