Sitemap

NO DATA NO Machine Learning Chapter -6 Linux Commands

2 min readJul 11, 2024

--

The story of data

Press enter or click to view image in full size

LINUX Commands

Return your user name:

whoami

Return your user and group id:

id

Return operating system name, username, and other info:

uname -a

Display reference manual for a command:

man top

List available man pages, including a brief description for each command:

man -k .

Get help on any command (for eg: curl):

curl --help

Return the current date and time:

date

Navigating and working with directories

List files and directories by date, newest to last:

ls -lrt

Find files in directory tree that end in .sh:

find -name \'\*.sh\'

Return path to present working directory:

pwd

Make a new directory:

mkdir new_folder

Change the current directory:

Get Krushna Thakkar’s stories in your inbox

Join Medium for free to get updates from this writer.

Up one level:

cd ../

To home:

cd ~` or `cd

To some other directory: cd path_to_directory:

rmdir temp_directory -v

Monitoring system performance and status

List selection of/all running processes and their PIDs:

ps
ps -e

Display resource usage:

top

List mounted file systems and usage:

df

Creating, copying, moving, and deleting files:

Create an empty file or update existing file’s timestamp:

touch a_new_file.txt

Copy a file:

cp file.txt new_path/new_name.txt

Change file name or path:

mv this_file.txt that_path/that_file.txt

Remove a file verbosely:

rm this_old_file.txt -v

Working with file permissions

Change/modify file permissions to ‘execute’ for all users:

chmod  +x  my_script.sh

Change/modify file permissions to ‘execute’ only for you, the current user:

chmod u+x my_file.txt

Remove ‘read’ permissions from group and other users:

chmod go-r

Displaying file and string contents

Display file contents:

cat my_shell_script.sh

Display file contents page-by-page:

more ReadMe.txt

Display first 10 lines of file:

head -10 data_table.csv

Display last 10 lines of file:

tail -10 data_table.csv

Display string or variable value:

echo "I am not a robot"  
echo "I am $USERNAME"

Basic text wrangling

Sorting lines and dropping duplicates:

Sort and display lines of file alphanumerically:

sort text_file.txt

In reverse order:

sort -r text_file.txt

Drop consecutive duplicated lines and display result:

uniq list_with_duplicated_lines.txt

Displaying basic stats:

Display the count of lines, words, or characters in a file:

Lines:

wc  -l table_of_data.csv

words:

wc -w my_essay.txCharacters:


wc -m some_document.txt

--

--