This document provides an introduction and overview of the Linux command line. It begins with an introduction and roadmap, then covers topics like navigating the filesystem, basic commands, permissions, processes, and editing text files. Examples and exercises are provided throughout to demonstrate key commands. The goal is to help users learn the basic skills needed to interact with a Linux system using the command line interface.
Per chi incomincia addentrarsi nel magico mondo dei comandi da terminale la vita può essere dura. In rete esistono diverse guide, ma la “Linux Bash Shell Cheat Sheet for Beginners” di Raphael è qualcosa che i principianti dovrebbero tenere a portata di mano. La segnaliamo un po’ perchè è molto semplice e chiara, e un po’ perchè è stata scritta da un sedicenne canadese. Personalmente è una cosa che mi fa piacere, perchè dimostra che anche i giovanissimi si accostano a linux nel modo migliore, ovvero “imparo e a mia volta diffondo”.
Per chi incomincia addentrarsi nel magico mondo dei comandi da terminale la vita può essere dura. In rete esistono diverse guide, ma la “Linux Bash Shell Cheat Sheet for Beginners” di Raphael è qualcosa che i principianti dovrebbero tenere a portata di mano. La segnaliamo un po’ perchè è molto semplice e chiara, e un po’ perchè è stata scritta da un sedicenne canadese. Personalmente è una cosa che mi fa piacere, perchè dimostra che anche i giovanissimi si accostano a linux nel modo migliore, ovvero “imparo e a mia volta diffondo”.
This lecture discusses the concept of Multi-User support in Linux. It discusses how Linux protects user files and resources from other user unauthorized access. It also shows how to share resources and files among users, how to add/del users and groups.
Check the other Lectures and courses in
http://Linux4EnbeddedSystems.com
or Follow our Facebook Group at
- Facebook: @LinuxforEmbeddedSystems
Lecturer Profile:
- https://www.linkedin.com/in/ahmedelarabawy
Unix vs Linux | Difference Between Unix & Linux | EdurekaEdureka!
YouTube Link: https://youtu.be/7L5JMj82vYU
** Linux Admin Certification Training: https://www.edureka.co/linux-admin **
This Unix vs Linux Tutorial PPT will help you understand the basic differences between both of these operating systems while giving you an idea about each of the Operating Systems.
Follow us to never miss an update in the future.
YouTube: https://www.youtube.com/user/edurekaIN
Instagram: https://www.instagram.com/edureka_learning/
Facebook: https://www.facebook.com/edurekaIN/
Twitter: https://twitter.com/edurekain
LinkedIn: https://www.linkedin.com/company/edureka
BITS: Introduction to Linux - Text manipulation tools for bioinformaticsBITS
This slide is part of the BITS training session: "Introduction to linux for life sciences."
See http://www.bits.vib.be/index.php?option=com_content&view=article&id=17203890%3Abioperl-additional-material&catid=84&Itemid=284
This lecture discusses the concept of Multi-User support in Linux. It discusses how Linux protects user files and resources from other user unauthorized access. It also shows how to share resources and files among users, how to add/del users and groups.
Check the other Lectures and courses in
http://Linux4EnbeddedSystems.com
or Follow our Facebook Group at
- Facebook: @LinuxforEmbeddedSystems
Lecturer Profile:
- https://www.linkedin.com/in/ahmedelarabawy
Unix vs Linux | Difference Between Unix & Linux | EdurekaEdureka!
YouTube Link: https://youtu.be/7L5JMj82vYU
** Linux Admin Certification Training: https://www.edureka.co/linux-admin **
This Unix vs Linux Tutorial PPT will help you understand the basic differences between both of these operating systems while giving you an idea about each of the Operating Systems.
Follow us to never miss an update in the future.
YouTube: https://www.youtube.com/user/edurekaIN
Instagram: https://www.instagram.com/edureka_learning/
Facebook: https://www.facebook.com/edurekaIN/
Twitter: https://twitter.com/edurekain
LinkedIn: https://www.linkedin.com/company/edureka
BITS: Introduction to Linux - Text manipulation tools for bioinformaticsBITS
This slide is part of the BITS training session: "Introduction to linux for life sciences."
See http://www.bits.vib.be/index.php?option=com_content&view=article&id=17203890%3Abioperl-additional-material&catid=84&Itemid=284
The structure of Linux - Introduction to Linux for bioinformaticsBITS
This 3th slide deck of the training 'Introduction to linux for bioinformatics' gives a broad overview of the file system structure of linux. We very gently introducte the command line in this presentation.
File is a container for storing information. It can be treated as a sequence of characters. Unlike the old DOS files, a UNIX file doesn‟t contain eof (end- of –file) mark. A file‟s size is not stored in the file, nor even its name. All files attributes are kept in separate area of hard disk, not accessible to humans, but only to the kernel.ThesisScientist.com
Introduction to Linux OS, Linux file system hierarchy, Linux commands, Files permissions, Input-Output redirection, Environment variables, Process management, Linux shell scripting.
Transcript: Selling digital books in 2024: Insights from industry leaders - T...BookNet Canada
The publishing industry has been selling digital audiobooks and ebooks for over a decade and has found its groove. What’s changed? What has stayed the same? Where do we go from here? Join a group of leading sales peers from across the industry for a conversation about the lessons learned since the popularization of digital books, best practices, digital book supply chain management, and more.
Link to video recording: https://bnctechforum.ca/sessions/selling-digital-books-in-2024-insights-from-industry-leaders/
Presented by BookNet Canada on May 28, 2024, with support from the Department of Canadian Heritage.
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...James Anderson
Effective Application Security in Software Delivery lifecycle using Deployment Firewall and DBOM
The modern software delivery process (or the CI/CD process) includes many tools, distributed teams, open-source code, and cloud platforms. Constant focus on speed to release software to market, along with the traditional slow and manual security checks has caused gaps in continuous security as an important piece in the software supply chain. Today organizations feel more susceptible to external and internal cyber threats due to the vast attack surface in their applications supply chain and the lack of end-to-end governance and risk management.
The software team must secure its software delivery process to avoid vulnerability and security breaches. This needs to be achieved with existing tool chains and without extensive rework of the delivery processes. This talk will present strategies and techniques for providing visibility into the true risk of the existing vulnerabilities, preventing the introduction of security issues in the software, resolving vulnerabilities in production environments quickly, and capturing the deployment bill of materials (DBOM).
Speakers:
Bob Boule
Robert Boule is a technology enthusiast with PASSION for technology and making things work along with a knack for helping others understand how things work. He comes with around 20 years of solution engineering experience in application security, software continuous delivery, and SaaS platforms. He is known for his dynamic presentations in CI/CD and application security integrated in software delivery lifecycle.
Gopinath Rebala
Gopinath Rebala is the CTO of OpsMx, where he has overall responsibility for the machine learning and data processing architectures for Secure Software Delivery. Gopi also has a strong connection with our customers, leading design and architecture for strategic implementations. Gopi is a frequent speaker and well-known leader in continuous delivery and integrating security into software delivery.
State of ICS and IoT Cyber Threat Landscape Report 2024 previewPrayukth K V
The IoT and OT threat landscape report has been prepared by the Threat Research Team at Sectrio using data from Sectrio, cyber threat intelligence farming facilities spread across over 85 cities around the world. In addition, Sectrio also runs AI-based advanced threat and payload engagement facilities that serve as sinks to attract and engage sophisticated threat actors, and newer malware including new variants and latent threats that are at an earlier stage of development.
The latest edition of the OT/ICS and IoT security Threat Landscape Report 2024 also covers:
State of global ICS asset and network exposure
Sectoral targets and attacks as well as the cost of ransom
Global APT activity, AI usage, actor and tactic profiles, and implications
Rise in volumes of AI-powered cyberattacks
Major cyber events in 2024
Malware and malicious payload trends
Cyberattack types and targets
Vulnerability exploit attempts on CVEs
Attacks on counties – USA
Expansion of bot farms – how, where, and why
In-depth analysis of the cyber threat landscape across North America, South America, Europe, APAC, and the Middle East
Why are attacks on smart factories rising?
Cyber risk predictions
Axis of attacks – Europe
Systemic attacks in the Middle East
Download the full report from here:
https://sectrio.com/resources/ot-threat-landscape-reports/sectrio-releases-ot-ics-and-iot-security-threat-landscape-report-2024/
DevOps and Testing slides at DASA ConnectKari Kakkonen
My and Rik Marselis slides at 30.5.2024 DASA Connect conference. We discuss about what is testing, then what is agile testing and finally what is Testing in DevOps. Finally we had lovely workshop with the participants trying to find out different ways to think about quality and testing in different parts of the DevOps infinity loop.
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...UiPathCommunity
💥 Speed, accuracy, and scaling – discover the superpowers of GenAI in action with UiPath Document Understanding and Communications Mining™:
See how to accelerate model training and optimize model performance with active learning
Learn about the latest enhancements to out-of-the-box document processing – with little to no training required
Get an exclusive demo of the new family of UiPath LLMs – GenAI models specialized for processing different types of documents and messages
This is a hands-on session specifically designed for automation developers and AI enthusiasts seeking to enhance their knowledge in leveraging the latest intelligent document processing capabilities offered by UiPath.
Speakers:
👨🏫 Andras Palfi, Senior Product Manager, UiPath
👩🏫 Lenka Dulovicova, Product Program Manager, UiPath
In his public lecture, Christian Timmerer provides insights into the fascinating history of video streaming, starting from its humble beginnings before YouTube to the groundbreaking technologies that now dominate platforms like Netflix and ORF ON. Timmerer also presents provocative contributions of his own that have significantly influenced the industry. He concludes by looking at future challenges and invites the audience to join in a discussion.
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...SOFTTECHHUB
The choice of an operating system plays a pivotal role in shaping our computing experience. For decades, Microsoft's Windows has dominated the market, offering a familiar and widely adopted platform for personal and professional use. However, as technological advancements continue to push the boundaries of innovation, alternative operating systems have emerged, challenging the status quo and offering users a fresh perspective on computing.
One such alternative that has garnered significant attention and acclaim is Nitrux Linux 3.5.0, a sleek, powerful, and user-friendly Linux distribution that promises to redefine the way we interact with our devices. With its focus on performance, security, and customization, Nitrux Linux presents a compelling case for those seeking to break free from the constraints of proprietary software and embrace the freedom and flexibility of open-source computing.
Enhancing Performance with Globus and the Science DMZGlobus
ESnet has led the way in helping national facilities—and many other institutions in the research community—configure Science DMZs and troubleshoot network issues to maximize data transfer performance. In this talk we will present a summary of approaches and tips for getting the most out of your network infrastructure using Globus Connect Server.
PHP Frameworks: I want to break free (IPC Berlin 2024)Ralf Eggert
In this presentation, we examine the challenges and limitations of relying too heavily on PHP frameworks in web development. We discuss the history of PHP and its frameworks to understand how this dependence has evolved. The focus will be on providing concrete tips and strategies to reduce reliance on these frameworks, based on real-world examples and practical considerations. The goal is to equip developers with the skills and knowledge to create more flexible and future-proof web applications. We'll explore the importance of maintaining autonomy in a rapidly changing tech landscape and how to make informed decisions in PHP development.
This talk is aimed at encouraging a more independent approach to using PHP frameworks, moving towards a more flexible and future-proof approach to PHP development.
A tale of scale & speed: How the US Navy is enabling software delivery from l...sonjaschweigert1
Rapid and secure feature delivery is a goal across every application team and every branch of the DoD. The Navy’s DevSecOps platform, Party Barge, has achieved:
- Reduction in onboarding time from 5 weeks to 1 day
- Improved developer experience and productivity through actionable findings and reduction of false positives
- Maintenance of superior security standards and inherent policy enforcement with Authorization to Operate (ATO)
Development teams can ship efficiently and ensure applications are cyber ready for Navy Authorizing Officials (AOs). In this webinar, Sigma Defense and Anchore will give attendees a look behind the scenes and demo secure pipeline automation and security artifacts that speed up application ATO and time to production.
We will cover:
- How to remove silos in DevSecOps
- How to build efficient development pipeline roles and component templates
- How to deliver security artifacts that matter for ATO’s (SBOMs, vulnerability reports, and policy evidence)
- How to streamline operations with automated policy checks on container images
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofsAlex Pruden
This paper presents Reef, a system for generating publicly verifiable succinct non-interactive zero-knowledge proofs that a committed document matches or does not match a regular expression. We describe applications such as proving the strength of passwords, the provenance of email despite redactions, the validity of oblivious DNS queries, and the existence of mutations in DNA. Reef supports the Perl Compatible Regular Expression syntax, including wildcards, alternation, ranges, capture groups, Kleene star, negations, and lookarounds. Reef introduces a new type of automata, Skipping Alternating Finite Automata (SAFA), that skips irrelevant parts of a document when producing proofs without undermining soundness, and instantiates SAFA with a lookup argument. Our experimental evaluation confirms that Reef can generate proofs for documents with 32M characters; the proofs are small and cheap to verify (under a second).
Paper: https://eprint.iacr.org/2023/1886
Epistemic Interaction - tuning interfaces to provide information for AI supportAlan Dix
Paper presented at SYNERGY workshop at AVI 2024, Genoa, Italy. 3rd June 2024
https://alandix.com/academic/papers/synergy2024-epistemic/
As machine learning integrates deeper into human-computer interactions, the concept of epistemic interaction emerges, aiming to refine these interactions to enhance system adaptability. This approach encourages minor, intentional adjustments in user behaviour to enrich the data available for system learning. This paper introduces epistemic interaction within the context of human-system communication, illustrating how deliberate interaction design can improve system understanding and adaptation. Through concrete examples, we demonstrate the potential of epistemic interaction to significantly advance human-computer interaction by leveraging intuitive human communication strategies to inform system design and functionality, offering a novel pathway for enriching user-system engagements.
Pushing the limits of ePRTC: 100ns holdover for 100 daysAdtran
At WSTS 2024, Alon Stern explored the topic of parametric holdover and explained how recent research findings can be implemented in real-world PNT networks to achieve 100 nanoseconds of accuracy for up to 100 days.
UiPath Test Automation using UiPath Test Suite series, part 4DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 4. In this session, we will cover Test Manager overview along with SAP heatmap.
The UiPath Test Manager overview with SAP heatmap webinar offers a concise yet comprehensive exploration of the role of a Test Manager within SAP environments, coupled with the utilization of heatmaps for effective testing strategies.
Participants will gain insights into the responsibilities, challenges, and best practices associated with test management in SAP projects. Additionally, the webinar delves into the significance of heatmaps as a visual aid for identifying testing priorities, areas of risk, and resource allocation within SAP landscapes. Through this session, attendees can expect to enhance their understanding of test management principles while learning practical approaches to optimize testing processes in SAP environments using heatmap visualization techniques
What will you get from this session?
1. Insights into SAP testing best practices
2. Heatmap utilization for testing
3. Optimization of testing processes
4. Demo
Topics covered:
Execution from the test manager
Orchestrator execution result
Defect reporting
SAP heatmap example with demo
Speaker:
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
2. A word from our sponsor…
This class is brought to you courtesy of:
Advanced Research Computing – Technical Services
ARC‐TS
For more information please click on:
http://arc‐ts.umich.edu
1/15
kgw 2016 2
3. Roadmap
The command shell
Navigating the filesystem
Basic commands & wildcarding
Shell redirection & pipelining
Editing text files
Permissions
Processes
Environment variables and customizing your session
1/16
cja/kgw 2016 3
4. Course Text
William E Shotts, Jr.,
“The Linux Command Line: A
Complete Introduction,”
No Starch Press, January 2012.
Download Creative Commons Licensed version at
http://downloads.sourceforge.net/project/linuxcommand
/TLCL/13.07/TLCL‐13.07.pdf.
10/14
cja 2014 4
8. The command shell
The command shell is an application that reads command lines
from the keyboard and passes them to the Linux operating
system to be executed.
When you login to a remote Linux system, using a tool like
ssh, you will automatically be connected to a shell.
Your computing session is kept separate from other user’s
computing sessions, because they are “enclosed” in a
“shell”.
On your desktop, laptop, or tablet, you may have to find and
execute a terminal emulator application to bring up a shell in
a window.
10/14
cja 2014 8
9. The command shell
10/14
cja 2014 9
http://askubuntu.com/questions/161511/are-the-linux-utilities-parts-of-the-kernel-shell
10. The command line
A basic way of interacting with a Linux system
Execute commands
Create files and directories
Edit file content
Access the web
Copy files to and from other hosts
Run HPC jobs
… do things you can’t do from the conventional point‐
and‐click Graphical User Interface (GUI)
10/14
cja 2014 10
11. Why command line?
1. Linux was designed for the command line
2. You can create new Linux commands using the command
line, without programming
3. Many systems provide only the command line, or poorly
support a GUI interface
• Such as most HPC systems
4. Many things can be accomplished only through the
command line
• Much systems administration & troubleshooting
5. You want to be cool
10/14
cja 2014 11
12. Connecting via ssh
Terminal emulators
Linux and Mac OS X
Start Terminal
Use ssh command
Windows
U-M Compute at the U (Get Going)
http://its.umich.edu/computing/computers-software/compute
PuTTY
http://www.chiark.greenend.org.uk/~sgtatham/putty/
10/14
cja 2014 12
13. Logging in to a host
We will be using the host: linux‐training.arc‐ts.umich.edu for
our class.
For Mac or other Linux workstation, from a terminal window
type: ssh uniqname@linux‐training.arc‐ts.umich.edu
On a PC, start PuTTY. In the
“Host Name (or IP address)” box
type:
linux‐training.arc‐ts.umich.edu
Click on the “Open” button.
Once connected, you will see:
“login as:”. Type in your
uniqname and press: enter
10/14
kgw 2016 13
14. Logging in to a host
You will be prompted:
“uniqname@linux‐training.arc‐ts.umich.edu's password:”
Enter your Level 1 password and press enter.
You are now logged into a shell on the linux‐training host
Your shell prompt looks like this:
uniqname@training:~$
10/14
cja 2014 14
15. The shell prompt
The “uniqname@training:~$“ is the shell prompt
This means the shell is waiting for you to type
something
Format can vary, usually ends with “$” , “%” or “#”
If $ or %, you have a normal shell
This shell has your privileges
If #, you have a so‐called “root shell”
This shell has administrator privileges
You can do a great deal of irreversible damage
10/14
kgw 2016 15
16. Typing into the shell
Basic input line editing commands
Backspace erases previous character
Left and right arrow move insertion point on the line
Control‐c interrupts whatever command you started and returns
you to the shell prompt (usually)
Control‐u erases the line from the beginning to the cursor
Control‐k erases the line from the cursor to the end
Enter executes the line you typed
Up and down arrow will access your command history
Type “exit” and press Enter without the quotes to exit the shell
Click the red "close" icon at the top of the Terminal window to close
it (on a Mac)
10/14
cja 2014 16
17. Lab 1
Task: Enter some basic commands
~$ date
~$ id
~$ ps
~$ df ‐kh
~$ who
~$ top # type Control‐c or q to exit
~$ history
10/14
cja 2014 17
19. Linux Filesystem Concepts
Files are stored in a directory (think: folder)
Directories may contain other directories as
well as files
A hierarchy of directories is called a directory
tree
A directory tree (a connected graph with no
cycles) has a single, topmost root directory
A directory tree, rooted at the system root
directory “/”, is called a filesystem
10/14
cja 2014 19
21. Linux Filesystem Concepts
A file is accessed using its path name
Absolute path name
/dir1/dir2/…/dirn/filename
/usr/X11R6/bin
Relative path name
current‐working‐directory/filename
bin
Every shell maintains a notion of a current working directory
Initialized at login to your home directory
Changed via cd command
Two special directories
. refers to the current directory
.. refers to the current directory’s parent directory
Many ways to get “home”
~ refers to your home directory
$HOME is a synonym for ~
~username refers to a user’s home directory
10/14
cja 2014 21
23. Prerequisites
Some fundamental commands:
~$ file file # what kind of file is file?
~$ cat file # display contents of text file
~$ less file # paginate text file
~$ man command # get info about command
Exercise: figure out how to make the date command
display the date in Coordinated Universal Time (UTC)
10/14
cja 2014 23
24. Navigating the filesystem
Some fundamental commands:
~$ pwd # print working directory
~$ cd dir # make dir the current working directory
~$ cd # cd to your home dir
~$ cd ~cja # cd to cja’s home dir
~$ mkdir dir # create directory dir
~$ rmdir dir # remove (empty) directory dir
~$ rm ‐fR dir # remove directory dir (empty or not)
~$ tree # display dir tree
10/14
cja 2014 24
25. Lab 2
Task: navigate the file system
Commands:
~$ cd # make your home directory
the current working directory
~$ pwd # print working directory
~$ mkdir foo # create directory foo
~$ cd foo # cd to the foo directory
~$ mkdir bar # create directory bar
~$ cd .. # go up one level in the directory tree
~$ tree foo # display foo’s directory tree.
(Use tree ‐A in PuTTY)
10/14
cja 2014 25
26. Listing info on files
ls – list information about files
~$ ls # list contents of cur dir
~$ ls dir # list contents of dir
~$ ls ‐l # list details of files in cur dir
including access, owner & group,
size, and last‐modified time
~$ ls ‐t # list newest files first
~$ ls ‐R dir # list all files in tree dir
~$ ls ‐lt dir # options can be combined
~$ ls ‐hl dir # list all files in human readable
format
10/14
cja 2014 26
27. Working with files
These commands manipulate files
~$ mv big large # rename file big to large
~$ cp big large # copy file big to large
~$ cp ‐r dir1 dir2 # copy dir tree dir1 to dir2
~$ cp f1 f2 dir # copy file1 and file2 to directory dir
~$ mkdir dir # create empty directory dir
~$ rmdir dir # remove empty directory dir
~$ rm file # remove file file
~$ rm ‐r dir # remove directory tree dir
10/14
cja 2014 27
28. Lab 3
Exercise:
Create a directory named tutorial in your home
directory. In that directory, create a directory named
sample and a directory named test . Create a file
named msg in directory test that contains a copy of the
file /etc/os‐release.
Extra credit: Make the last‐modified time of your copy
identical to that of /etc/os‐release. Hint: look at the
options of the copy command
10/14
cja 2014 28
32. File Permissions, examples
‐rw‐‐‐‐‐‐‐ cja lsait 40 Oct 1 12:03 foo.bz2
file read and write rights for the owner, no access for
anyone else
chmod u=rw,g=r,o= file
‐rw‐r‐‐‐‐‐ cja lsait 40 Oct 1 12:03 foo.bz2
file read and write rights for the owner, read for
members of the lsait group and no access for others
drwxr‐x‐‐x cja lsait 4096 Oct 1 12:15 bar
list, modify, and search for the owner, list and search
for group, and execute only for others
10/14
cja 2014 32
33. Lab 4
Task: copy sample files for further exercises
Commands:
~$ cd # make your home directory
the current working directory
~$ pwd # print working directory to verify you
are in your home directory
~$ mkdir training # create directory training
~$ cd training # cd to the training directory
~$ cp ‐rf /data/examples/IntroLinux/. .
# copies sample files to training directory
10/14
cja 2014 33
35. Compressing and archiving
These commands compress and archive files
~$ gzip foo # compress foo to foo.gz
~$ gunzip foo # uncompress foo.gz to foo
~$ bzip2 foo # better compress foo to foo.bz2
~$ bunzip2 foo # uncompress foo.bz2 to foo
~$ tar ‐cf foo.tar bar # archive subtree bar in file foo.tar
~$ tar ‐xf foo.tar # restore archive from file foo.tar
~$ tar ‐tf foo.tar # list files in archive file foo.tar
~$ tar ‐zcf foo.tgz bar # archive and compress
~$ tar ‐jcf foo.tjz bar # archive and compress better
Exercise: Archive and compress the files in the training directory to a file
named examples_train.tgz
10/14
cja 2014 35
36. Wildcards
The shell accepts wildcarded arguments
This is also called "shell globbing"
Wildcards:
? Matches a single character
* Matches zero or more characters
[chars] Matches any of the chars
[c1‐c2] Matches chars ‘c1’ through ‘c2’
[^chars] Matches any but the chars
~$ ls foo.? # match files named foo.x, where x
is any character
~$ echo *.[cs] # echo files that end in .c or .s
~$ mv [o‐z]* save # move files starting with o through
z to directory save
~$ echo [^A‐Z]? # ???
10/14
cja 2014 36
38. Shell redirection
A Linux command can have its inputs and outputs redirected
~$ ls >myfiles # put list of files in current
directory into file myfiles
~$ ls >>filelist # add list of files in current
directory to end of file filelist
~$ sort <grocery.list # sort lines from file grocery.list
~$ sort <<EOF # sort lines entered at keyboard
whiskey # (this is a “here document”)
bravo
tango
EOF
~$ wc ‐l </etc/os‐release >~/mycounts
# count number of lines from file
/etc/os‐release and put result in
file mycounts in my home directory
10/14
cja 2014 38
39. More Linux commands
More useful Linux tool commands
~$ grep string # show lines of input containing
string
~$ tail # show last few lines of input
~$ head # show first few lines of input
~$ sort # sort the input
~$ du ‐sh # report the size of the current directory
~$ du ‐sh dir # report the size of directory dir
~$ who # gives a list of the users currently
logged in
~$ cut ‐cxx‐yy # keep the output from a command starting
at the xx character in the line and ending
at the yy character
10/14
cja 2014 39
40. Shell pipelining
A Linux command can have its output connected to the
input of another Linux command
~$ ls | wc –l # count files in current
directory
~$ last | grep reboot # when did we reboot?
Exercises:
How many users are currently logged in?
How many unique user IDs are currently logged in?
10/14
cja 2014 40
42. Editing text files
Simple editor
nano
"What you see is what you get” editor
Simple to learn if you want to get started quickly
No mouse support. Arrow keys for navigation
Supported editors
vi or vim
emacs
Powerful but more complex
If you have time and inclination to become proficient,
spend time here
10/14
cja 2014 42
43. Text files
Watch out for source code or data files
written on Windows systems
Use these tools to analyze and convert source
files to Linux format
file
dos2unix
unix2dos
10/14
cja 2014 43
45. File Transfers
Eventually, you will need to move/copy files to and from your computer and a
server/workstation/cluster. You can do this using the secure copy command (scp) in a terminal
window.
To transfer files (i.e. foobar.txt) FROM your local host TO a remote host use:
~$ scp foobar.txt your_username@remotehost.edu:/some/remote/directory
To transfer files (i.e. foobar.txt) FROM a remote host TO your local host use:
~$ scp your_username@remotehost.edu:foobar.txt /some/local/directory
To copy a directory, repeat as above adding the ‐r flag. (~$ scp ‐r … )
Graphical, drag‐and‐drop scp programs are available for Windows and Mac platforms.
(WinSCP – Windows, Cyberduck – Mac)
1/15
cja/kgw 2015 45
Demonstration
I will Copy the file headtail.txt from the training directory to /home/kgweiss
directory using SCP on the remote host flux‐xfer.arc‐ts.umich.edu
47. Processes
Modern operating systems are usually multitasking, meaning that
they create the illusion of doing more than one thing at once by
rapidly switching from one executing program to another. The
Linux kernel manages this through the use of processes. Processes
are how Linux organizes the different programs waiting for their
turn at the CPU.
On Linux, every program runs in a process
You can examine these processes
man ps
ps
ps ax
top
10/14
cja 2014 47
49. Additional commands
~$ quota ‐Q ‐s $USER # show disk quota for $USER
~$ grep “sometext” somefile # find & print sometext if found
in somefile
~$ history # displays last n commands entered
(execute again with !###)
~$ clear # clears the screen
~$ diff ‐w file1 file2 # compare file1 with file2
ignoring all white space
~$ which command # prints the full path to command
~$ acommand | tee filename # takes the results from acommand and
prints them to the screen and to
the file filename
(Use tee –a to append to filename)
~$ source filename # reads and executes the commands contained
in filename
10/14
cja 2014 49
51. Environment Variables
An environment variable is a named object that contains data used by
one or more applications. In simple terms, it is a variable with a name
and a value.
The convention in Linux is for the environment variable to be all
uppercase letters.
To use an environment variable, prefix the variable name with $
You can see the value of an environment variable by typing:
~$ echo $VARIABLENAME
You can see all the environment variables defined for your session
by typing: ~$ env
You can set an environment variable by typing:
~$ export VARIABLENAME = value
1/15
cja/kgw 2015 51
52. Common Environment
Variables
USER # $USER ‐‐> user login name
PATH # $PATH ‐‐> a list of
directories to look into for programs
and files
HISTSIZE # $HISTSIZE ‐‐> number of commands
to keep in history
HOSTNAME # $HOSTNAME ‐‐> fully enumerated host name
HOME # $HOME ‐‐> home directory of the user
TERM # $TERM ‐‐> terminal type
SHELL # $SHELL ‐‐> shell type you are using
10/14
cja 2014 52
53. Customizing Your Session
You can modify certain aspects of your session to do your work in
terms that are easier/more useful for you. See chapter 11 in Schott’s
book
Changes can be made in ~/.bashrc file.
It is recommended that you use an external file, (in our class,
~/training/.custom) and then source it from the .bashrc file
You can:
Set an alias
Export an environment variable
Change directories
Execute a Linux command or an external program
1/16
kgw 2016 53
Exercises
1) Modify the .custom file in the training directory creating a new alias named ‘llh’
that gives a directory listing in human readable file sizes
2) Create a new environment variable CLASS that points to your training directory
3) Source this file and see if your customizations worked
54. Any Questions?
Ken Weiss
Health Information Technology & Services
kgweiss@umich.edu
arc‐workshop‐instructors@umich.edu
734 763 7503
10/14
cja 2014 54
55. References
1. http://en.wikipedia.org/wiki/History_of_Linux
2. http://www.openbookproject.net/tutorials/getdown/unix/lesson2.html
3. William E Shotts, Jr., “The Linux Command Line: A Complete Introduction,” No Starch
Press, January 2012. Download Creative Commons Licensed version at
http://downloads.sourceforge.net/project/linuxcommand/TLCL/13.07/TLCL‐13.07.pdf.
4. Learning the nano editor
1. The nano text editor ‐ https://www.lifewire.com/beginners‐guide‐to‐nano‐editor‐
3859002
2. Beginners guide to nano ‐ http://www.howtogeek.com/howto/42980/the‐
beginners‐guide‐to‐nano‐the‐linux‐command‐line‐text‐editor/
5. Learning the VI editor
1. VIM Adventures ‐ http://vim‐adventures.com/
2. Graphical cheat sheet ‐ http://www.viemu.com/vi‐vim‐cheat‐sheet.gif
3. Interactive VIM tutorial ‐ http://www.openvim.com/
10/14
cja 2014 55