Tags: commands, linux, red hat, terminal

————————

bg – sent a process to background

chmod – change file permissions

example: chmod 777 file.txt

first number stands for the user, second for the group and third for others

0 = – – – = no permissions

1 = – – x = execution

2 = – w – = write

4 = r – – = read

3 = 2 + 1 = – w x = write & execute

5 = 4 + 1 = r – x = read & execute

6 = 4 + 2 = r w – = read & write

7 = 4 + 2 + 1 = r w x = read & write & execute

chmod -R 775 folder – changing permissions for all files and sub-folders for a given folder. “-R stands for recursive”

cp – copy

usage: cp what where

example: cp file.txt /home/folder1

df -h – check disk size and how much space is available and how much is used

du disk usage

—–> example 1: du -hs – check your disk usage (size of YOUR files)

—–> example 2: du -h –max-depth=1 – check size of folders

find – find a file

usage: find where-to-look criteria what-to-do

example: find . -name ‘*name_of_the_searched_file*’ – find the searched file in current folder and its subfolders

example: find . -user john – find/search for files whose owner is “user”

example: find . -type f -not \( -name ‘*zip’ -or -name ‘*iso’ \) -delete //delete all files exept all *zip and *iso files

gedit – open gedit text editor

example: gedit file.txt

head – print the first 10 lines of the chosen file

example 1: head file.txt – print the first 10 lines of file.txt

example 2: head -n 100 file.txt – print the first 100 lines of file.txt

ip addr show – show ip address

[http://www.wikihow.com/Check-Ip-Address-in-Linux]

example 1: ip addr show – look on the address listed after “inet” word. If more than one “inet” words are displayed, most probably you are looking for the one associated with “eth0”

example 2: ip addr show eth0 – only information correspond to eth0 is displayed

kill – kill a process

example: kill -9 process_id

lllist files in a current location

example: ll -h – list files in a human friendly format “-h”

example: ll | less – interactive list of files where cursors, PageUp, PageDown, Home, End can be used to navigate through the list

—–> * – any string

—–> ? – any single character

lnlink creation

usage: ln -s path_to_file desired_name_of_link

lpq – printer sessions

ls – list files in current directory

—–> * – any string

—–> ? – any single character

mkdir – make a directory (create a folder)

example: mkdir folder2

mv – move a file or change its name

usage: mv what where

example: mv file.txt /home/folder1

nedit – open nedit text editor

example: nedit file.txt

passwd – change your password

ps – print list of processes

example 1: ps aux

example 2: ps -u john

pwd – show path (where I am?)

rm – remove

example: rm -rf * – remove every file and sub-folder in a current directory. “-r” stands for “recursive”, “-f” stands for “force”, “*” stands for “everything”.

scp – stands for “secure copy”. Chosen files are copied to, from, or between different hosts. “scp” command uses ssh for data transfer and provides the same authentication and same level of security as ssh.

—–> example: scp [email protected]_host:file.txt /chosen/directory/.

ssh

—–> example 1: ssh [email protected] [email protected]_address

—–> example 2: ssh -X [email protected] – connect using ssh and be able to use for example gedit (gedit file.txt)

su – become a root

top – show processes

—–> Shift + m – sort by memory usage

—–> Shift + p – sort by processor usage

xkill – select a window to kill

Ctrl + Cterminate process

Ctrl + Zsleep process

Ctrl + Shift + T – open new terminal tab

Ctrl + Shift + PageDownmove current tab right

Ctrl + Shift + PageUp move current tab left