Home
About
One-Line Commands
Navigate List & Locate Move & Copy Edit & Convert Machine & Network Notes
Scripts coming soon

digital collection automation toolkit

one-line commands

task Windows PowerShell Bash
locate current directory get-location pwd
change directory one forward cd Downloads cd Downloads
change directory one back cd .. cd ..
change to a directory that includes a space cd "Meeting agendas" cd "Meeting agendas"
change directory to home user cd ~ cd ~
change prompt to different user cd C:\Users\michelle su - michelle
show username get-localuser whoami

list and locate files

task Windows PowerShell Bash
list all files in current directory get-childitem ls -lh -1
list files in directory, name only ls -name ls -1
list files in directory, filter by file type get-childitem -filter "*.pdf" find . -name "*.pdf"
list files in directory, filter by file type AND only print file names get-childitem -name -filter "*.pdf"
list files in directory, filter by multiple file types get-childitem -file | where-object { $_.Extension -in ".pdf", ".mp3" }
list files in directory, filter by the beginning of a file name get-childitem -filter "*2024*"
list files in directory, filter by the beginning of a file name AND file type get-childitem -filter "2024_*.pdf"
list files in directory, sort by largest to smallest get-childitem -file | sort-object -property length -descending ls -laS -lh
list files in directory, show 10 largest files get-childitem -file | sort-object -property length -descending | select-object -first 10 ls -laS -lh | head -n 10
list files in directory, filter by files larger than x-size get-childitem -file | where-object { $_.Length -gt 100mb} find . -type f -size +100M
list files in directory, filter by files within a size range get-childitem -file | where-object { $_.Length -gt 10mb -and $_.Length -lt 100mb }
list files in directory, show in alphabetical order get-childitem | sort-object -property name ls
list files in directory, show only file names in alphabetical order ls
list files in directory, sort by last edited (newest-to-oldest) get-childitem -file | sort-object -property lastwritetime -descending ls -t
list files in directory, sort by 10 most recently edited get-childitem -file | sort-object -property lastwritetime -descending | select-object -first 10 ls -t -1 | head -10
list files in directory, sort by 10 least recently edited get-childitem -file | sort-object -property lastwritetime -ascending | select-object -first 10 ls -lh -ltr -1 | head -10
list files in directory in table view get-childitem | format-table -autosize name, length, lastwritetime
list files in directory, show count of each file type get-childitem -recurse -file | group-object extension | sort-object count -descending
list files in directory, export to txt file ls -name >> inventory.txt ls > inventory.txt
list files in directory, export file paths to txt
list all hidden files in directory ls -a -1
locate a specific file find ~/Documents -name "1994report.jpg"
locate a file based on file type get-childitem -recurse -filter "*.wav"

move and copy files

task Windows PowerShell Bash
move a file move-item "presentation.pdf" -desination "C:\Users\michelle\archive" mv presentation.pdf ~/archive
move multiple files mv file1.doc file2.pdf ~/archive
move all of a specific file type move-item *.mp4 -destination "C:\Users\michelle\archive" mv *.mp4 ~archive
move all files in a directory move-item * -desintation "C:\Users\michelle\archive" mv * ~/archive
copy a file copy-item "project.doc" -destination "C:\Users\michelle\archive" cp project.doc ~/archive
copy multiple files cp interview.mp3 transcript.txt ~/archive

edit and convert files

task Windows PowerShell Bash
create a file touch test.txt\

Spaces not allowed. Use underscore or no spaces
rename a file rename-item "2014-agenda.doc" -newname "2015-agenda.doc" mv 2014-agenda.doc 2015-agenda.doc
rename multiple files
convert file type (image files)
convert file type (audiovisual files) ffmpeg -i interview.mp3 interview.wav
check image file metadata exiftool eventphotos.jpg
remove all image file metadata exiftool -all= eventphotos.jpg
replace spaces with underscores in all file names in a directory rename 's/ /_/g' *

To install "rename," run: sudo apt install rename
remove spaces in all file names in a directory rename 's/ //g' *

machine and network specs

task Windows PowerShell Bash
check which shell you're using echo $0
check OS version winver cat /etc/os-release
local machine name hostname
check IP address ip addr show

notes

Blue text indicates a placeholder example and should be replaced with your specific information.

-1: gives each output on its own line (Bash only)
-lh: lists files in a human readable format (Bash only)
Ctrl+Shift+C: copies something in the terminal
Ctrl+Shift+V: pastes something in the terminal