14
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
this post was submitted on 28 May 2024
14 points (88.9% liked)
Linux
48366 readers
637 users here now
From Wikipedia, the free encyclopedia
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.
Rules
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.
- No misinformation
- No NSFW content
- No hate speech, bigotry, etc
Related Communities
Community icon by Alpár-Etele Méder, licensed under CC BY 3.0
founded 5 years ago
MODERATORS
plug in the usb, run the command lsblk. it will list all the block devices that the computer can see.
look for your usb by size, etc. the column "name" after lsblk will be the device and partition (for example sdc and sdc1). the "name" entry on the same line as your usb's size with a number after it is the partition, the one without a number is the usb itself. you will be mounting the partition.
make a directory in /var to mount the usb stick in with mkdir /var/usb. that command writes to the /var section of your filesystem, where /var-iable files live. mount the usb stick at that location with mount /dev/[your partition, like sdc1] /var/usb.
example: my usb was /dev/sdc1, so for me it's mount /dev/sdc1 /var/usb. the syntax is mount [device] [location].
run any command with |tee -i /var/usb/target_filename.txt after it to both output the command to the screen and send it to a file on the usb. that command writes the output of whatever command preceeds it to the specified file in /var/usb.
example: ls / |tee -i /var/usb/target_filename.txt would write the output of the command "ls /", listing the contents of the root of your filesystem, to /var/usb/target_filename.txt as well as displaying it. if /ver/usb/target_filesystem.txt doesn't exist, it will be created.
use different files on different commands so you don't write over what you have or pass -a to the tee command so it will -a-ppend the text it writes to the end of the file. ex: |tee -ia /var/usb/filename.txt
for the specific command you asked about, it would be dpkg -l |tee -i /var/usb/target_filename
to write out your command history, use the "history" command. it can be given the tee treatment as well. to access a users history look at their $HISTFILE. if you don't know what interpreter they're using, assume bash and look for ~/.bash_history
thanks for the input
Did you get it straightened out?
yup