https://github.com/asadprodhan/navigating_a_linux_computer

Navigating a Linux Computer

https://github.com/asadprodhan/navigating_a_linux_computer

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (11.3%) to scientific vocabulary
Last synced: 10 months ago · JSON representation

Repository

Navigating a Linux Computer

Basic Info
  • Host: GitHub
  • Owner: asadprodhan
  • License: gpl-3.0
  • Default Branch: main
  • Homepage:
  • Size: 139 KB
Statistics
  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Created over 2 years ago · Last pushed about 1 year ago
Metadata Files
Readme License

README.md

Navigating a Linux Computer

Asad Prodhan*

DPIRD Diagnostics and Laboratory Services
Department of Primary Industries and Regional Development
3 Baron-Hay Court, South Perth, WA 6151, Australia
*Correspondence: Asad.Prodhan@dpird.wa.gov.au


License GPL 3.0 ORCID


Q: How to use my Linux computer remotely?

  • Open a ssh client. For example, MobaXterm
  • Click on ‘Session’ located at top-left corner
  • Fill up the following boxes and click ‘OK’:
    • Remote host
    • Specify username
    • SSH-browser type as SFTP protocol


Figure 1: MobaXterm.


Q: How to enable sftp on the sidebar in the MobaXterm?

  • Go to MobaXterm Session settings > SSH > Fill up Remote host > Specify username > Select ‘SFTP protocol’ from the ‘SSH-browser type’ drop down menu


Q: How to transfer data between a remote computer and your local laptop?

Option 1: Drag and drop using the left panel of your MobaXterm

Option 2: sftp - sftp username@remotehost:/destinationdirectory - ‘put -r’ to transfer data from local to remote - ‘put -ar’ to transfer data that failed in the first attempt - ‘get -r’ to transfer from remote to local


🐧 Linux Usage Exercise for New User

Welcome to Linux training! This brief guide will help you get started with essential Linux commands and concepts.


📁 1. Working with Directories (i.e. Folders)

Check your current location

pwd

See what you have in your current location

ls

Create a new directory called 'practice'

mkdir practice

Move into the directory

cd practice

Create nested directories

mkdir -p projects/scripts

Go up one directory

cd ..


📄 2. Working with Files

Create a new text file

echo "Hello, Linux!" > hello.txt

View the content

cat hello.txt

Copy the file

cp hello.txt hello_backup.txt

Rename the file

mv hello.txt greetings.txt

Delete the backup

rm hello_backup.txt


🔍 3. Viewing and Searching

View contents of a file

less greetings.txt

Search inside the file

grep "Hello" greetings.txt

List files with details

ls -lh


👥 4. User and Permissions

Check who you are

whoami

See your groups

groups

Check file permissions

ls -l greetings.txt

Change permissions (read/write for user only)

chmod +x greetings.txt

Or,

chmod +x *


⚙️ 5. System Information and Help

View disk usage

df -h

See memory usage

free -h

View running processes

top

Get help on commands

man ls


🧑‍💻 6. Sudo and Package Installation

Update package list

sudo apt update

Install a basic tool (example: tree)

sudo apt install tree

Use the installed tool

tree


✅ 7. Create a Simple Script

Create a script file

nano say_hello.sh

Paste the following content into the file:

```

!/bin/bash

echo "Hello, $USER! Today is $(date)." ```

Then run:

Make it executable

chmod +x say_hello.sh

Execute the script

./say_hello.sh


🚀 You're Ready!

You've just taken your first steps into Linux! Continue experimenting using the following Linux commands to explore further


GREP

| Code/ Symbol | Command/ Elaboration | Function/ Example | |:----------|:----------|:----------| | grep | Search and print lines containing a word | grep 'salmon' File.tsv > FileSalmon.tsv | | grep --color | Search text | grep --color "Lunch" File1.txt | | grep --color -A 2 "word" | Print 2 lines after the match | grep --color -A 2 "word" File1.txt | | grep --color -B 2 "word" | Print 2 lines before the match | grep --color -B 2 "word" File1.txt | | grep --color -C 2 "word" | Print 2 lines before and after the match | grep --color -C 2 "word" File1.txt | | grep -v "word" | Find everything except 'word' | grep -v "word" File1.txt | | grep -c "[WW]ord" | Count the occurrence of 'W/word' | grep -c "[WW]ord" File1.txt |


SED

| Code/ Symbol | Command/ Elaboration | Function/ Example | |:----------|:----------|:----------| | sed -n 3p | Extract the 3rd line | sed -n 3p File1.txt | | sed -n 3-5p | Extract the 3rd to 5th lines | sed -n 3-5p File1.txt | | sed 's/Find/Replace/g' File.txt | Find and replace | sed 's/Ishmael/Dave/g' File1.txt; "Ishmael" replaced by "Dave" |


AWK

| Code/ Symbol | Command/ Elaboration | Function/ Example | |:----------|:----------|:----------| | awk '{print $1,$2,$3,$4,$5,$7}' | Subset columns 1-5, 7 | awk '{print $1,$2,$3,$4,$5,$7}' file.tsv
| awk '{print $3}' | Print third column | awk '{print $3}' File.tsv | | awk '{print $3,"\t"50}' | Print third column and add 50 at reach row; /t is tab space | awk '{print $3,"\t"50}' File.tsv | | awk '{print $3,"\t"$3+1}' | Print third column and add 1 with all row values | awk '{print $3,"\t"$3+1}' File.tsv |


CUT

| Code/ Symbol | Command/ Elaboration | Function/ Example | |:----------|:----------|:----------| | cut -f1,2,3,4,5,7 | Subset columns 1-5, 7 | cut -f1,2,3,4,5,7 File1.txt


NANO

| Code/Symbol | Function/Example |
|:----------|:----------| | alt+sht+$ | wraps lines | | alt+sht+y | highlights syntex | | alt+sht+# | puts line number | | fg | to return to nano | | ctrl+K | deletes entire line | | ctrl+A | moves the cursor at the beginning of the line | | ctrl+E or Alt+/ | moves the cursor at the end of the line | | Ctrl+Shift+- 7406148 | Jump to line number 7406148 | | Ctrl+W | Search for words |


PUTTY

| Code/Symbol | Function/Example |
|:----------|:----------| | psftp> get -r * | download one file | | psftp> mget -r * | download multiple files | | psftp> put -r * | upload one file | | psftp> mput -r * | upload multiple files |


## TMUX

| Code/Symbol | Function/Example |
|:---------- |:----------| | tmux > press enter | start tmux session | | Ctrl-b d | detach from the tmux session but the session will continue running in the background | | tmux list | list all the active tmux sessions. Left-hand column shows the session numbers | | tmux attach -t 1 | logging in into tmux session 1 | | tmux kill-session -t 1 | terminating tmux session 1 |

Owner

  • Name: Asad Prodhan
  • Login: asadprodhan
  • Kind: user
  • Location: Perth, Australia
  • Company: Department of Primary Industries and Regional Development

Laboratory Scientist at DPIRD. My work involves Oxford Nanopore Sequencing and Bioinformatics for pest and pathogen diagnosis.

GitHub Events

Total
  • Push event: 7
Last Year
  • Push event: 7