User Tools

Site Tools


linux_command_line_basics

Linux Command Line Basics

There are a number of good resources on the web. Here's one of them:

http://linuxcommand.org/index.php

Commands you should know

Changing Your Password

Note: this does not apply to users who log in with their Unity Id and password.

passwd

There is a 12-character minimum length requirement on the cluster.

pwd - print working directory
ls - list files
cd - change directory
less - file pager
file - describes type of a file

File Manipulation

cp - copy 
mv - move (rename)
rm - remove (delete)
mkdir - make directory
rmdir - remove directory

Editing Text

Choose an editor:

nano
vi
emacs

Basic Script

#!/bin/bash
...

Make a script file “executable”:

chmod u+x scriptname

Getting More Information

man COMMAND
man ls

IO Redirection

Save output from a command to file.

ls > file.txt

Terminal Multiplexing

This lets you run multiple terminals that are immune to “hang-ups” (network errors) and can remain active even after you log out. You “detach” from the terminal and then re-attach after logging back in.

screen

Other terminal multiplexers (byobu, tmux) are also installed on the cluster.

Finding Files

Find a file by name:

find . -name lost_file.txt

find is a very flexible (and quite complicated) tool for finding files and applying commands to the results. It's well worth learning more about this command.

Disk Space Use

Calculate the total size of a directory:

du -sh dirname
linux_command_line_basics.txt · Last modified: 2022/01/26 10:40 by root