Linux commands

Command Description

whoami

Displays the username of the current user when this command is invoked.

rmdir

remove empty directories

tail

output the last part of files

uniq

report or omit repeated lines

ps

report a snapshot of the current processes

sleep

delay for a specified amount of time

ln

make links between files

man

an interface to the on-line reference manuals

rm

remove files or directories

date

print or set the system date and time

diff

compare files line by line

top

display Linux processes in dynamic real time view

uname

+ prints the OS name (ex. Linux, Darwin)
uname -a : prints all system information, including machine name, kernel name, version …​

gzip

compress or expand files

who

show who is logged on

clear

clear the terminal screen

touch

change file timestamps

cat

Used to list the contents of a file.
- cat > filename creates a new file
- cat filename1 filename2>filename3 joins two files (1 and 2) and stores the output of them in a new file (3)

find

search for files in a directory hierarchy

kill

send a signal to a process

gunzip

compress or expand files

su

run a command with substitute user and group ID

pwd

print name of current/working directory

open

open and possibly create a file

more

view the text files in the command prompt, displaying one screen at a time in case the file is large

less

opposite of more

pipe

pipes help combine two or more commands and are used as input/output concepts in a command.

free

display the amount of free and used physical and swap memory in the system
free -m : gives the information using megabytes

grep

print lines that match patterns

killall

kill processes by nam

tar

an archiving utility

sudo

execute a command as another user

ls

Used to view the contents of a directory.
- ls -R will list all the files in the sub-directories as well
- ls -a will show the hidden files
- ls -al will list the files and directories with detailed information like the permissions, size, owner, etc.

mv

move (rename) files

echo

display a line of text

du

estimate file space usage

jobs

nano

Nano’s ANOther editor, an enhanced free Pico clone

passwd

change user password

cd

Allows to navigate through the Linux files and directories.

cp

copy files and directories

wc

print newline, word, and byte counts for each file

df

report file system disk space usage for all partitions
df -h : display human-readable disk space usage

fg

alias

chown

change file owner and group

mkdir

make directories

head

output the first part of files

sort

sort lines of text files

history

GNU History Library

bg

xargs

build and execute command lines from standard input

chmod

change file mode bits

pwd

Find out the path of the current working directory (folder) you’re in.

ps

view all the processes running on the machine

The shell {} operator

Example with three directories enclosed in {}:
mkdir -p -v /home/josevnz/tmp/{dir1,anotherdir,similardir}

sed

Replace a string on one or more files without using an editor:
sed -i 's#ORIGINAL_VALLUE#NEW_VALUE#g' myfile1 myfile2

perl

Replace a string on one or more files without using an editor:
perl -p -i -e 's#ORIGINAL#NEW_VALUE#' myfile1 myfile2

cat

Write instantaneous files:
cat<<DOC>/my/new/file
or cat > testfile

grep

Use the grep way to search for specific files:
grep -R 'import' --include='*.java' --color MySourceCodeDir

find

Use the find way to search for specific files:
`find MySourceCodeDir/ -name '*.java' -type f -print

xargs \ grep --color 'import`

watch

Other command-line tools from third parties

Command Description

youtube-dl

download videos on Youtube and other video portals
1) youtube-dl https://www.youtube.com/watch?v=Film-ID
2) youtube-dl -o ' ~/videos/film.mp4 ' Film-URL
3) youtube-dl -F Film-URL
4) youtube-dl -f Number Film-URL
5) youtube-dl --playlist-start 3 --playlist-end 5 Playlist-URL