Tag Info

Hot answers tagged

22

Look into installing sshfs if you're on Linux. You can remotely connect to a machine over ssh, but it will show it as part of the file system on your local machine, so you can edit files in your local editor, and treat it as if it were a local file. You don't even have to install anything on the server side, it all just works off of ssh. Similarly, there ...


14

From sysfs.txt: sysfs is a ram-based filesystem [...]. It provides a means to export kernel data structures, their attributes, and the linkages between them to userspace. In essence /sys allows you to get information about the system and its components (mostly attached and installed hardware) in a structured way. See also the Wikipedia Article on ...


11

The problem is not how you can use date to output what you want... your problem is: This way I'd like to get the old logfiles out of my way, but still have 5-6 days of logfiles around. So, why not using find to remove all files but this week's? find /path/to/files/ -mtime +7 -exec rm {} \; In addition, date has many different implementations - I ...


7

If you are running the connection from Windows, you can check out WinSCP. It is free, and gives you a tree-view (Explorer-like) of the file system that you have access to. If you are running from a *nix environment, you'll need to enable some sort of file access to it, such as FTP (insecure), SFTP (secure), or you can mount the remote filesystem as a CIFS, ...


6

Once a piece of malware has gained access to a user's account, it can: 1. Create a bash alias (in the current shell, and in ~/.bashrc) to a command which fakes the [sudo] password for $USER: prompt, and steals the user's password. alias sudo='echo -n "[sudo] password for $USER: " && \ read -r password && \ echo ...


6

If you use convert, you can specify the parameter > to only shrink bigger images, leaving the other untouched (the \ is required, or the magic char > is not escaped): convert large_image.png -resize 1248x1024\> large_image.png convert not_large_image.png -resize 1248x1024\> not_large_image.png It will only change the bigger images. [ETA] convert ...


5

The > is interpreted by the shell not by the program. Since subprocess doesn't use a shell by default, the > is passed directly to the program. Using shell=True might work, but to redirect stdout, you should use the stdout argument. For example, you could use import subprocess with open('data.csv', 'w') as f: subprocess.Popen(['iperf', '-s', '-u', ...


5

Can't beat Wikipedia's simplicity: Filesystem Hierarchy Standard > FHS compliance Modern Linux distributions include a /sys directory as a virtual filesystem (sysfs, comparable to /proc, which is a procfs), which stores and allows modification of the devices connected to the system, whereas many traditional UNIX and Unix-like operating systems use ...


5

Maybe badblocks is what you need. It will do all the work for you - namely, detect read, write and corruption errors.


5

This fork bomb is described here In bash, a function can be defined function_name() { ... } where ... is the implementation or body of the function :(){ ... } defines a function named :. :|: runs the function within itself - that is recursively, and pipes it's output to another invocation of itself. & runs the preceding command in the ...


5

You would do that like this: date -d "+1 days" +%a That renders: Sat


4

Current Linux desktops often have some kind of sshfs built-in. Eg. in Gnome, open the file manager (Nautilus), press Ctrl+L to get an editable location bar, and enter an URL like sftp://example.com/ and press Enter. This will open an SSH (actually SFTP) connection to example.com and present its contents in the file manager, and you can browse it like any ...


4

The answer to the question in the title is right there at the beginning of the output: ELF 64-bit LSB executable, x86-64 ELF is the Executable and Linkable Format, the binary executable file format most commonly used by Linux. x86-64 is the architecture of the binary, the 64-bit version of the x86 instruction set originally introduced by AMD. For ...


4

See "Parameter Expansion" in man bash: ${parameter:=word} Assign Default Values. If parameter is unset or null, the expansion of word is assigned to parameter. The value of parameter is then substituted. Positional parameters and special parameters may not be assigned to in this way. The colon is ...


4

In the spirit of "DoTheSimplestThingThatCanPossiblyWork" don't try and reinvent the wheel here. Run with some easily commercially available and stable platform (EG iPad is a fairly universal thing, decent build quality, known form factor, etc.) as your job is not to invent some new hardware platform but to make a kiosk that presents some content. You cannot ...


4

The data is usually stored on a virtual drive made up of RAM. Hence, when you reboot, the data is lost. But you also can mount the hard drives within your computer after booting, and move the downloaded files onto those drives. Then, they're still available after reboot.


4

you can do this using watch. It is not completely real-time, but close enough (up to a tenth of a second): watch -n0.1 ls from the manual: -n, --interval seconds Specify update interval. The command will not allow quicker than 0.1 second interval, in which the smaller values are converted.


4

I think the command that will best help you is tac: http://linux.die.net/man/1/tac As it states: tac - concatenate and print files in reverse So you could pipe it to grep and match nnn number of lines before stopping, or something along those lines.


4

This behavior you are looking for is controlled by rsync's -o (--owner) switch, possibly together with --no-numerics-ids. The man page describes --owner thus (my emphasis): -o, --owner This option causes rsync to set the owner of the destination file to be the same as the source file, but only if the receiving rsync is being run as the ...


4

Your first guess was right, but you used a bad example.  When the shell reads the command foo=bar echo $foo the first thing it does (or, at least, one of the first things) is to look for variable references (like $foo) and evaluate them.  Then it processes what’s left of the line.  (This may be a bit of an oversimplification; see bash(1) or the Bash ...


3

Use curl. It will output the content of the page on stdout: mtak@frisbee:~$ curl www.google.com <HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8"> <TITLE>302 Moved</TITLE></HEAD><BODY> <H1>302 Moved</H1> The document has moved <A ...


3

It's possible, and it's very frequently done with both external USB sticks and internal drives. Regarding partition table types: BIOS normally doesn't need any partition table. It is only interested in the bootstrap code part that is the first 440 bytes of your MBR. (Although there are exceptions. Some BIOS implementations actually do break if they cannot ...


3

dd doesn't interpret data, it's just dumping bytes from source to target. It doesn't know what it's copying or if it matters. If you want to make an intelligent copy (ie. skip empty space etc.) you can use partclone, partimage or Clonezilla (which is, in fact, just a more convenient wrapper to those two tools).


3

No; dd is a dumb tool - you tell it were to start, where to stop, and it copies everything in between. It has no knowledge of partitions, partition maps, drives, filesystems, or what remotely might constitute valuable or important data (other than everything between aforementioned start and finish). If you have a partition with low filesystem utilization ...


3

a Shell is a program you use to interface with the computer, it can be a command line interface, or a point and click interface. Bash is a shell, as is Gnome2, etc. Terminal is a loaded term in modern computing. it comes from the old mainframe days when you typed on a hardware device wired directly to the mainframe (a thin client, with just a keyboard and a ...


3

When you're working on the same file system, mv does not actually copy the file contents somewhere else and deletes the original. It just moves the pointer to the file (simply speaking), or renames it. The inode number of mved files will not change. When working across file systems, mv will only copy and then delete the original files, one by one.


3

No. Sed does not use Perl-compatible regexes. Regular expression support for GNU tools is documented here: https://www.gnu.org/software/gnulib/manual/html_node/Regular-expression-syntaxes.html#Regular-expression-syntaxes \d is the character d. You can use [[:digit:]] but not \d


3

In many modern CPUs, including Intel and AMD models, some instructions are executed directly in hardware, and some are "microcoded" - essentially, such instructions are internally made up of a series of smaller internal-to-the-CPU-only instructions. I'm not sure what you call the facility inside the CPU that "executes" microcode, and I believe microcode ...


3

The line tar (child): xz: Cannot exec: No such file or directory gives you the real error. The xz programm cannot be executed, probably because it is not installed. To install the xz (de)compression tools, issue sudo apt-get install xz-utils


3

"Copy symlinks as symlinks" means exactly what it says: If rsync sees a symlink in the source directory, it will create an identical symlink in the destination. Nothing more. (A few lines down in the manual page, a different option, --copy-links, describes the opposite behavior (always copying the data) which you described as undesirable.) See also the ...



Only top voted, non community-wiki answers of a minimum length are eligible